Skip to content

Import budgeting projects into accountability results#9604

Merged
ahukkanen merged 43 commits intodecidim:developfrom
mainio:feature/import-budgets-from-accountability
Sep 2, 2022
Merged

Import budgeting projects into accountability results#9604
ahukkanen merged 43 commits intodecidim:developfrom
mainio:feature/import-budgets-from-accountability

Conversation

@sinaeftekhar
Copy link
Copy Markdown
Contributor

🎩 What? Why?

A normal proceeding order in a PB process is:

  1. Collect and work on ideas ("proposals")
  2. Arrange the PB voting ("projects")
  3. Follow-up on the progress of the projects that won ("results")

Right now we can import accepted proposals to projects.
But, we cannot import "selected" projects to results.

This is a problem for admins who prefer not to waste their time doing copy-paste work.
We have added a similar importing feature in the accountability component as we have right now in the budgets component.

The import considers the following:

  • Copy the title and description from the project
  • Map the result to the same category and scope that the project had (or the budget's scope if the project does not have a scope defined)
  • Add the first "default" status to the new results
  • Add a "default" progress value from the first status or zero if no statuses are available

Above, the "default" status refers to the first status ordered by their progress percentages.

📌 Related Issues

Testing

No prerequisite is needed to run the tests. Run the tests, as if you would normally.

📷 Screenshots

Navigate to the your Accountability component, and click on "Import Projects to Results" link (as shown below)
image
Now, select the origin component, from which you want to import the selected projects, select "Import all selected projects" and click Import:
image

Your project is now added to the list with a success message:
image

♥️ Thank you!

@ahukkanen ahukkanen changed the title Feature/import budgets from accountability Import budgeting projects into accountability results Jul 25, 2022
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall great work for the first feature PR! Everything works as expected when testing it in the development app.

Regarding the code, I've left some refactoring comments below, can you please go through.

I've also found one bug that the message how many projects are available is not visible if I submit the form and it had errors:
Invisible import message

Also, this feels kind of weird as a "success" message:
Success when nothing was imported

So can we either
a) change the message to an error message showing something like "There were no projects to import within the selected component"
OR
b) prevent submitting the form in case there are no projects altogether

@ahukkanen
Copy link
Copy Markdown
Contributor

I found this old bug report regarding the proposal imports (import proposals between components): #7608.

I think this is also a relevant point regarding this PR that we should consider here.

So, we still need to do the following changes here:

  1. We need to move the import processing to a background job and when the background job is successfully started, show a success message such as "Import processing has stated. You will receive an email after it has completed."
  2. Once the import processing has successfully completed, send an email to the user who started it with the information on how many results were imported and to which component (with a link to the component admin panel listing the results).

We have similar functionality already in Decidim where you can take inspiration from, such as the CSV import within the same accountability component.

The other point about handling long running jobs better mentioned at #7608 is a separate issue and we need to tackle that later on. Right now, just follow what is already being done in other imports that are background processed.

@sinaeftekhar sinaeftekhar marked this pull request as draft August 9, 2022 07:57
@sinaeftekhar sinaeftekhar marked this pull request as ready for review August 9, 2022 13:56
@sinaeftekhar sinaeftekhar marked this pull request as draft August 9, 2022 15:20
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's starting to be pretty close to completed.

A couple of further cleanup efforts + one bugfix still needed I noticed when going through.

@sinaeftekhar sinaeftekhar marked this pull request as ready for review August 11, 2022 14:51
ahukkanen
ahukkanen previously approved these changes Aug 11, 2022
Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Before merging, we need to go it through and demo it for @decidim/product before we merge it to the core to see if they are happy with the changes.

@carolromero
Copy link
Copy Markdown
Member

carolromero commented Aug 31, 2022

Thanks for the demo @sinaeftekhar! I would only suggest grouping the import options (csv, budgets) in a single drop-down button. Otherwise, looks good to me.

@sinaeftekhar
Copy link
Copy Markdown
Contributor Author

sinaeftekhar commented Sep 1, 2022

Thanks for the demo @sinaeftekhar! I would only suggest grouping the import options (csv, budgets) in a single drop-down button. Otherwise, looks good to me.

Thanks @carolromero for the comment. The suggestion has been applied, and is now ready for the review

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Just one more request regarding the import dropdown positionning and then I think this is done.

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Before merging this, could you @carolromero also confirm that this is now good to go from product standpoint? This is what the requested import dropdown now looks like after the latest changes:
Import dropdown

@carolromero
Copy link
Copy Markdown
Member

@ahukkanen looks great, green light to merge!

@ahukkanen ahukkanen merged commit a72b605 into decidim:develop Sep 2, 2022
@ahukkanen ahukkanen deleted the feature/import-budgets-from-accountability branch September 2, 2022 10:47
entantoencuanto added a commit that referenced this pull request Sep 9, 2022
* develop:
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
entantoencuanto added a commit that referenced this pull request Sep 12, 2022
* develop:
  Fix doorkeeper initialization after 5.6.0 release (#9785)
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
  Redesign: flash messages (#9774)
entantoencuanto added a commit that referenced this pull request Sep 12, 2022
* develop:
  Fix doorkeeper initialization after 5.6.0 release (#9785)
  Add additional details in HTTP 500 error page message (#9762)
  Publication date field for blog articles (#9757)
  Import budgeting projects into accountability results (#9604)
eliegaboriau pushed a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* Import projects without checkpoints

The imports works with some exceptions:
- The system does not check if the record is already exist.
- The import don't show how many records are being imported.

* Fix bugs in adding already existing projects twice

* Complete import functionality

Add js functionality, so the number of items to be added is being
shown on as the user select the original component for import.

* Add permission to imports

* revise en locale for import message

* Remove text color when there are projects

* Fix a bug in command with current_component

* Remove unused methods from the controller

* Add tests for commands

* Complete tests for commands

* Mark unnecessary methods to be removed later

* Complete tests for ProjectImportController

* Refactor ImportProjectsToResults command

move some shared methods to form section and remove the redundants.

* Fix some introduced bugs from previous refactoring

* Complete form tests

* Add permission specs for the feature

* Refactor commands; remove extra spaces

* Add system test

* Show import link only in main page

* Fix linting violations

* Fix lint violation in imports.js file

* Add error when there are no projects to import

* Fix lint violations

* Address reviewers' comments

These changes have been applied:

- Redundant testing regrading for the permissions were removed
- Messages for the translation has been updated
- Extra comments were removed.

* Add mailer job to the Imports

The import is now being handled with a job, and the user will
be informed once the projects are imported.

* Fix a bug regarding the translation

* Add job to import task

The followings are being changes/edited:
- The tasks related to import projects moves to the job
- Mailer task added to inform the user once the task finished
- Fix violated tests, and added required tests
- Refactored some parts, with respect to the concept of job

* Fix a linting error

* Remove unused locales

* Fix issues mentioned by reviewer's

* Revert package-lock.json

* Fix the last set of comments

* Fix a typo

* Fix errors in pull request failure

* Fix a bug in a spec

* Resolve issues mentioned by reviewers

* Wrap up the import buttons into an 'Import button'

* Change the position of import button in the view
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants