change module api completion field presence
return false when no other requirements have been completed test plan: * create a module with a required item * as a student, without completing any other requirements, the context module items api should list the "completion_requirement" item as "completed": false closes #CNVS-24152 Change-Id: I0d5235d2e00a5097ec9e00f0f11d593a5a733eb7 Reviewed-on: https://gerrit.instructure.com/65510 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> QA-Review: Clare Strong <clare@instructure.com> Product-Review: James Williams <jamesw@instructure.com>
This commit is contained in:
parent
77690bb08f
commit
e33bf57212
|
@ -124,7 +124,7 @@ module Api::V1::ContextModule
|
|||
if criterion = context_module.completion_requirements && context_module.completion_requirements.detect { |r| r[:id] == content_tag.id }
|
||||
ch = { 'type' => criterion[:type] }
|
||||
ch['min_score'] = criterion[:min_score] if criterion[:type] == 'min_score'
|
||||
ch['completed'] = !!progression.requirements_met.detect{|r|r[:type] == criterion[:type] && r[:id] == content_tag.id} if progression && progression.requirements_met.present?
|
||||
ch['completed'] = !!(progression.requirements_met.present? && progression.requirements_met.detect{|r|r[:type] == criterion[:type] && r[:id] == content_tag.id}) if progression
|
||||
hash['completion_requirement'] = ch
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue