From 87e988a9eef1d1374aa441cd45a70e8db42d0227 Mon Sep 17 00:00:00 2001 From: Marcella Maki Date: Sun, 2 Jul 2023 17:24:48 -0400 Subject: [PATCH 1/3] Refactor the default completion and duration content completion options to be in utils.js, and make the default data visible in the resource panel --- .../channelEdit/components/ResourcePanel.vue | 15 ++- .../components/edit/CompletionOptions.vue | 59 ++-------- .../frontend/channelEdit/utils.js | 101 +++++++++++++++++- 3 files changed, 118 insertions(+), 57 deletions(-) diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue b/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue index 8046b9b591..5e249c1556 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/ResourcePanel.vue @@ -532,7 +532,12 @@ import sortBy from 'lodash/sortBy'; import { mapActions, mapGetters } from 'vuex'; import camelCase from 'lodash/camelCase'; - import { isImportedContent, importedChannelLink, getCompletionCriteriaLabels } from '../utils'; + import { + isImportedContent, + importedChannelLink, + getCompletionCriteriaLabels, + getAudioVideoDefaultDuration, + } from '../utils'; import FilePreview from '../views/files/FilePreview'; import { ContentLevels, Categories, AccessibilityCategories } from '../../shared/constants'; import AssessmentItemPreview from './AssessmentItemPreview/AssessmentItemPreview'; @@ -614,6 +619,9 @@ return getCompletionCriteriaLabels(this.node).completion; }, duration() { + if (this.isAudioVideo) { + return getAudioVideoDefaultDuration(this.files); + } return getCompletionCriteriaLabels(this.node).duration; }, files() { @@ -665,6 +673,11 @@ isResource() { return !this.isTopic && !this.isExercise; }, + isAudioVideo() { + return ( + this.node.kind === ContentKindsNames.AUDIO || this.node.kind === ContentKindsNames.VIDEO + ); + }, isImported() { return isImportedContent(this.node); }, diff --git a/contentcuration/contentcuration/frontend/channelEdit/components/edit/CompletionOptions.vue b/contentcuration/contentcuration/frontend/channelEdit/components/edit/CompletionOptions.vue index 6840c106bc..bc16858092 100644 --- a/contentcuration/contentcuration/frontend/channelEdit/components/edit/CompletionOptions.vue +++ b/contentcuration/contentcuration/frontend/channelEdit/components/edit/CompletionOptions.vue @@ -100,6 +100,12 @@