Skip to content

Commit 3771771

Browse files
committed
Add complete plan flag to plans/_show.json.jbuilder
- Add complete flag data to extension in json
1 parent 1e115f9 commit 3771771

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app/views/api/v2/plans/_show.json.jbuilder

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
json.schema 'https://github.com/RDA-DMP-Common/RDA-DMP-Common-Standard/tree/master/examples/JSON/JSON-schema/1.0'
66

7-
presenter = Api::V2::PlanPresenter.new(plan: plan)
7+
presenter = Api::V2::PlanPresenter.new(plan: plan, complete: @complete)
88

99
# Note the symbol of the dmproadmap json object
1010
# nested in extensions which is the container for the json template object, etc.
@@ -68,5 +68,19 @@ unless @minimal
6868
json.title template.title
6969
end
7070
end
71+
72+
if @complete
73+
json.complete_plan do
74+
q_and_a = presenter.complete_plan_data
75+
next if q_and_a.blank?
76+
77+
json.array! q_and_a do |item|
78+
json.title item[:title]
79+
json.section item[:section]
80+
json.question item[:question]
81+
json.answer item[:answer]
82+
end
83+
end
84+
end
7185
end
7286
end

0 commit comments

Comments
 (0)