-
Notifications
You must be signed in to change notification settings - Fork 119
Closed
Description
Please complete the following fields as applicable:
What version of the DMPRoadmap code are you running? (e.g. v2.2.0)
v4.2.0
Expected behaviour:
app/views/org_admin/templates/_form.html.erbincludes the following:
<%= f.check_box(:visibility, checked: f.object.visibility == 'organisationally_visible') %>app/views/org_admin/templates/_show.html.erbincludes the following:
<% if template.visibility == 'organisationally_visible' %>You'd expect these checks to verify the value of template.visibility
Actual behaviour:
3.0.5 :001 > Plan.visibilities
=> {"organisationally_visible"=>0, "publicly_visible"=>1, "is_test"=>2, "privately_visible"=>3}
3.0.5 :002 > Plan.first.visibility
Plan Load (1.2ms) SELECT "plans".* FROM "plans" ORDER BY "plans"."id" ASC LIMIT $1 [["LIMIT", 1]]
=> "privately_visible"
3.0.5 :003 > Template.visibilities
=> {"organisationally_visible"=>0, "publicly_visible"=>1}
3.0.5 :004 > Template.first.visibility
Template Load (1.2ms) SELECT "templates".* FROM "templates" ORDER BY "templates"."id" ASC LIMIT $1 [["LIMIT", 1]]
=> 0
While plan.visibility outputs the string representation of the enum value, template.visibilty outputs the integer. As a result, the aforementioned == 'organisationally_visibile' checks will always return false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels