From 5efc22220f541e457ff5d5964b455622008ad1c8 Mon Sep 17 00:00:00 2001 From: Kristin Aoki Date: Wed, 11 Aug 2021 10:35:17 -0400 Subject: [PATCH] Update model to store by id instead of hash key --- src/courseware/data/api.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/courseware/data/api.js b/src/courseware/data/api.js index ae9f1878..3eb9e99f 100644 --- a/src/courseware/data/api.js +++ b/src/courseware/data/api.js @@ -26,25 +26,25 @@ export function normalizeBlocks(courseId, blocks) { models.sections[block.id] = { id: block.id, title: block.display_name, - sequenceIds: block.hash_children || block.children || [], + sequenceIds: block.children || [], }; break; case 'sequential': - models.sequences[(block.hash_key || block.id)] = { + models.sequences[block.id] = { effortActivities: block.effort_activities, effortTime: block.effort_time, - id: block.hash_key || block.id, + id: block.id, title: block.display_name, legacyWebUrl: block.legacy_web_url, - unitIds: block.hash_children || block.children || [], + unitIds: block.children || [], hash_key: block.hash_key, }; break; case 'vertical': - models.units[(block.hash_key || block.id)] = { + models.units[block.id] = { graded: block.graded, - id: block.hash_key || block.id, + id: block.id, title: block.display_name, legacyWebUrl: block.legacy_web_url, hash_key: block.hash_key, @@ -260,6 +260,7 @@ function normalizeSequenceMetadata(sequence) { saveUnitPosition: sequence.save_position, showCompletion: sequence.show_completion, allowProctoringOptOut: sequence.allow_proctoring_opt_out, + hash_key: sequence.hash_key, decoded_id: sequence.decoded_id, }, units: sequence.items.map(unit => ({ @@ -272,6 +273,7 @@ function normalizeSequenceMetadata(sequence) { graded: unit.graded, containsContentTypeGatedContent: unit.contains_content_type_gated_content, decoded_id: unit.decoded_id, + hash_key: unit.hash_key, })), }; }