Skip to content

Commit

Permalink
Flag non-unique value at the whole value level.
Browse files Browse the repository at this point in the history
Disable editing of anything except the completion dropdown when non-unique.
  • Loading branch information
rtibbles committed Nov 4, 2022
1 parent 0ee2f0e commit 20abd99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<Checkbox
v-model="learnerManaged"
color="primary"
:indeterminate="notUnique"
:disabled="notUnique"
:label="$tr('learnersCanMarkComplete')"
style="padding-bottom: 16px;"
/>
Expand All @@ -17,6 +19,7 @@
ref="completion"
v-model="completionDropdown"
box
:placeholder="getPlaceholder('value')"
:items="showCorrectCompletionOptions"
:label="translateMetadataString('completion')"
:required="required"
Expand Down Expand Up @@ -61,6 +64,7 @@
ref="duration"
v-model="durationDropdown"
box
:placeholder="getPlaceholder('value')"
:items="selectableDurationOptions"
:label="translateMetadataString('duration')"
:required="required"
Expand Down Expand Up @@ -205,6 +209,9 @@
},
},
computed: {
notUnique() {
return this.value === nonUniqueValue;
},
model() {
return this.value.model || defaultCompletionCriteriaModels[this.kind];
},
Expand Down Expand Up @@ -238,6 +245,9 @@
},
completionDropdown: {
get() {
if (this.notUnique) {
return;
}
if (
this.value.modality === ContentModalities.QUIZ &&
this.model === CompletionCriteriaModels.MASTERY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,10 +635,11 @@
thumbnailEncoding: generateGetterSetter('thumbnail_encoding'),
completionAndDuration: {
get() {
const { completion_criteria, modality } = this.getExtraFieldsValueFromNodes(
'options',
{}
);
const options = this.getExtraFieldsValueFromNodes('options', {});
if (options === nonUniqueValue) {
return nonUniqueValue;
}
const { completion_criteria, modality } = options;
const suggested_duration_type = this.getExtraFieldsValueFromNodes(
'suggested_duration_type'
);
Expand Down

0 comments on commit 20abd99

Please sign in to comment.