Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix budgets zero single view #10892

Merged
merged 2 commits into from May 24, 2023

Conversation

greenwoodt
Copy link
Contributor

@greenwoodt greenwoodt commented May 22, 2023

馃帺 What? Why?

Component: Budgets

Budgets that were set to zero as an admin in the view would crash when a user wished to view them on the front end facing view.

A patch has been created in decidim-budgets/apps/models/decidim/budgera/order.rb in a form of a condition that takes this into account if the user wants a zero budget, allowing admins to view their budgets set at zero.

The validation has also been updated to take this into account within decidim-budgets/app/forms/decidim/budgets/admin/budget_form.rb

馃搶 Related Issues

Link your PR to an issue

Testing

  1. Login as a admin
  2. Head to edit under your admin acc
  3. Click processes on the left and a select any open or create a new one.
  4. Click budgets and create a new by pre-filling all the necessary information in the form.
  5. Under the "Total Budget", make sure that value is set to 0.
  6. Save this by "Create Budget" at the bottom of the form.
  7. You'll be taken back to the index of the budgets available and you'll notice you'll have your new budget set at 0.
  8. Preview this budget by clicking the eye icon on the right panel under actions.
  9. You'll be taken to the front end view of your new budget set at zero.

Rspec tests have also been created for patch, currently raking green for the following:

  • Budgets at zero patch: decidim-budgets/spec/system/orders_spec.rb
  • Validation check: decidim-budgets/spec/forms/decidim/budgets/admin/budget_form_spec.rb

馃摲 Screenshots

image

鈾ワ笍 Thank you!

Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

This PR contains the work done in #10855 .

Please run on your local environment:

git checkout develop 
git pull origin develop 
git branch -D fix/budgets-zero-single-view
git checkout -b fix/budgets-zero-single-view
git cherry-pick 2dc51df20219d7cdb2cc6e99c4627da5182799ce
git push origin -f 

decidim-budgets/app/models/decidim/budgets/order.rb Outdated Show resolved Hide resolved
@alecslupu alecslupu added module: budgets type: fix PRs that implement a fix for a bug labels May 22, 2023
@alecslupu alecslupu added this to Pending review from Product in Maintainers via automation May 22, 2023
@greenwoodt
Copy link
Contributor Author

@alecslupu thanks, I noticed when I pushed I had a previous PR's work following behind.

With regards to your suggestion on updating the patch, I have committed your suggestion. Thanks very much for your contribution.

@alecslupu
Copy link
Contributor

@greenwoodt , Please see my last comment: Run in a terminal ( console ) the following commands.

git checkout develop 
git pull origin develop 
git branch -D fix/budgets-zero-single-view
git checkout -b fix/budgets-zero-single-view
git cherry-pick 2dc51df20219d7cdb2cc6e99c4627da5182799ce
git cherry-pick dec506c6cce520f57485c4904aac77f633a90f50
git push origin -f 

@greenwoodt greenwoodt force-pushed the fix/budgets-zero-single-view branch from 4123e7a to b90fae6 Compare May 22, 2023 13:41
@greenwoodt
Copy link
Contributor Author

hi @alecslupu I saw your initial comment ran that command and your new suggested one on my machine. Apologies I had to recommit your commented changes previously. The PR should be updated and ready for review.

@greenwoodt greenwoodt requested a review from alecslupu May 22, 2023 13:52
Copy link
Contributor Author

@greenwoodt greenwoodt left a comment

Choose a reason for hiding this comment

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

Changes made ready for review

Copy link
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

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

LGTM ( tested locally and works as advertised )

@alecslupu alecslupu changed the title Fix/budgets zero single view Fix budgets zero single view May 24, 2023
@alecslupu alecslupu merged commit e224ab3 into decidim:develop May 24, 2023
9 checks passed
Maintainers automation moved this from Pending review from Product to Done May 24, 2023
@alecslupu alecslupu moved this from Done to Backport pending in Maintainers May 24, 2023
@alecslupu alecslupu moved this from Backport pending to Done in Maintainers Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: budgets type: fix PRs that implement a fix for a bug
Projects
Development

Successfully merging this pull request may close these issues.

Budgets component's single budget view crashes if budget is set to zero
2 participants