Skip to content

Add scope to proposals import in budgets#6525

Merged
Leusev merged 12 commits intodevelopfrom
feature/add-scope-to-proposal-import
Oct 14, 2020
Merged

Add scope to proposals import in budgets#6525
Leusev merged 12 commits intodevelopfrom
feature/add-scope-to-proposal-import

Conversation

@marinavega
Copy link
Copy Markdown

@marinavega marinavega commented Sep 16, 2020

🎩 What? Why?

Adds a selector to filter accepted proposals by scope in Import proposals to project.

📌 Related Issues

📋 Subtasks

  • Add scope selector
  • Filter proposals by scope
  • Update tests

📷 Screenshots (optional)

Screenshot 2020-09-17 at 09 24 29

Screenshot 2020-09-17 at 09 24 21

@marinavega marinavega linked an issue Sep 16, 2020 that may be closed by this pull request
1 task
@marinavega marinavega marked this pull request as ready for review September 17, 2020 07:25
@marinavega marinavega requested a review from agustibr September 17, 2020 07:25
agustibr
agustibr previously approved these changes Sep 17, 2020
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

😀 Good work!
Could you add a test example for an out-of-scope import?

@marinavega marinavega requested a review from agustibr September 18, 2020 13:47
@Leusev Leusev self-requested a review September 28, 2020 07:29
@Leusev Leusev self-assigned this Sep 28, 2020
@Leusev Leusev added in-review project: PAM2020 Barcelona City Council contract labels Sep 28, 2020
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

Good work! 😁

Just one more comment, I would rename decidim_scope_id to scope_id so that the field translates correctly in the ProjectImportProposalsForm and in the view where the scope_picker is rendered and thus it is not necessary to translate this field again, as now renders "Decidim scope" and it should be "Scope".

Screenshot 2020-09-28 at 18 08 36

Screenshot 2020-09-28 at 18 08 43

@marinavega marinavega requested a review from agustibr September 29, 2020 11:42
agustibr
agustibr previously approved these changes Sep 29, 2020
Copy link
Copy Markdown
Contributor

@agustibr agustibr left a comment

Choose a reason for hiding this comment

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

😀 ✨ Great! @marinavega

@marinavega marinavega requested a review from tramuntanal October 1, 2020 08:27
Copy link
Copy Markdown
Contributor

@tramuntanal tramuntanal left a comment

Choose a reason for hiding this comment

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

Sorry for being so nitypicky @marinavega but can you review the test, I think it is not working as expected, or I'm being lost somewhere...

it "doesn't create any project" do
expect do
command.call
end.not_to(change { Project.where(budget: budget).where(scope: scope).count })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure I'm understanding this test.

You've created a new, scope, but you are not using it anywere, and the let is without ! so it never gets created. The form double is initialized with scope_id: "" instead of scope, and also the name of the form attribute is decidim_scope_id, not scope_id so not sure if this is being setted correctly.
In the end the command executes all_proposals.where(decidim_scope_id: form.scope_id) and filters proposals were the scope_id equals an empty string, instead of the scope that was introduced for testing this situation but never gets created.

So I think the test succeeds accidentally but not because it executes as expected.
can you please give it a check and clarify my mind 😆

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Don't worry, this is actually super helpful! 😄 Let me check this so I can properly answer you all, guys 🙏🏻

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@Leusev @tramuntanal Ok, I didn't update all instances when renaming decidim_scope_id to scope_id.
I'll fix this 🙏🏻 TY again

Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

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

Good job @marinavega , just a couple of doubts..
Thanks !!

@tramuntanal
Copy link
Copy Markdown
Contributor

@marinavega there are some questions to be addressed in order to progress with the review, thanks

cc/ @mrcasals

@marinavega marinavega requested a review from tramuntanal October 7, 2020 16:21
@Leusev Leusev self-requested a review October 9, 2020 10:40
Copy link
Copy Markdown
Contributor

@Leusev Leusev left a comment

Choose a reason for hiding this comment

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

Thanks a lot for have been addressed either doubts as issues @marinavega 👍
From my side, everything looks correct. What about you @tramuntanal ?

@tramuntanal
Copy link
Copy Markdown
Contributor

LGTM @Leusev

@Leusev Leusev merged commit 41d13c2 into develop Oct 14, 2020
@Leusev Leusev deleted the feature/add-scope-to-proposal-import branch October 14, 2020 08:37
@mrcasals mrcasals changed the title Add scope to proposals import Add scope to proposals import in budgets Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option of Scope when importing Proposals to Budgets

5 participants