Roadmap bug 3086 - The share feature for Org plan visibility was broken:#3172
Merged
briri merged 1 commit intoMay 10, 2022
Conversation
one could only share plan if it is 100% completed. When this is set in property config/initializers/_dmproadmap.rb, e.g., 188: config.x.plans.default_percentage_answered = 50. Fix for Roadmap bug #3086. In app/models/phase.rb method visibility_allowed?(plan) is broken because the first line in method always return 0 unless the Rational() is 1 in value = Rational(num_answered_questions(plan), plan.num_questions) * 100 Change: - we fix issue by converting the Rational() value to a float as follows value = Rational(num_answered_questions(plan), plan.num_questions).to_f * 100
briri
approved these changes
May 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
one could only share plan if it is 100% completed. When this is set in
property config/initializers/_dmproadmap.rb, e.g.,
188: config.x.plans.default_percentage_answered = 50.
Fix for Roadmap bug #3086.
In app/models/phase.rb method visibility_allowed?(plan) is broken
because the first line in method always return 0 unless the Rational()
is 1 in
value = Rational(num_answered_questions(plan), plan.num_questions) * 100
Change:
value = Rational(num_answered_questions(plan), plan.num_questions).to_f * 100
Outputs within method
Prior to fix
server_1 | 1 <-- num_answered_questions(plan)
server_1 | 8 <-- plan.num_questions
server_1 | 0 <-- value = Rational(num_answered_questions(plan), plan.num_questions) * 100
After fix
server_1 | 1 <-- num_answered_questions(plan)
server_1 | 8 <-- plan.num_questions
server_1 | 12.5 <-- value = value = Rational(num_answered_questions(plan), plan.num_questions).to_f * 100
Repeated for another plan
server_1 | 4
server_1 | 8
server_1 | 50.0