Skip to content

Roadmap bug 3086 - The share feature for Org plan visibility was broken:#3172

Merged
briri merged 1 commit into
developmentfrom
bug_roadmap_3086-Org_visibility_plan_public_DMPs_only_appear_if_100_per_filled
May 10, 2022
Merged

Roadmap bug 3086 - The share feature for Org plan visibility was broken:#3172
briri merged 1 commit into
developmentfrom
bug_roadmap_3086-Org_visibility_plan_public_DMPs_only_appear_if_100_per_filled

Conversation

@johnpinto1

@johnpinto1 johnpinto1 commented May 10, 2022

Copy link
Copy Markdown
Contributor

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

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

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 briri merged commit 214a0c9 into development May 10, 2022
@briri briri deleted the bug_roadmap_3086-Org_visibility_plan_public_DMPs_only_appear_if_100_per_filled branch May 10, 2022 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants