Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@
}

if (this.kind === ContentKindsNames.H5P) {
if (!this.value['model']) {
if (
!this.value['model'] ||
this.value.model === CompletionCriteriaModels.DETERMINED_BY_RESOURCE
) {
return CompletionDropdownMap.determinedByResource;
}
return CompletionDropdownMap.completeDuration;
Expand All @@ -294,7 +297,7 @@
return '';
},
set(value) {
let update = {};
const update = {};
this.currentCompletionDropdown = value;

// FOR AUDIO/VIDEO
Expand Down Expand Up @@ -351,8 +354,8 @@
if (this.kind === ContentKindsNames.HTML5 || this.kind === ContentKindsNames.H5P) {
if (value === CompletionDropdownMap.determinedByResource) {
update.completion_criteria = {
model: this.value.model,
threshold: this.value.threshold,
model: CompletionCriteriaModels.DETERMINED_BY_RESOURCE,
threshold: null,
};
}
}
Expand Down Expand Up @@ -384,7 +387,7 @@
return { mastery_model: this.mastery_model };
},
set(threshold) {
let update = {};
const update = {};
if (threshold.mastery_model === MasteryModelsNames.M_OF_N) {
update.completion_criteria = {
model: CompletionCriteriaModels.MASTERY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Vue from 'vue';
import Vuetify from 'vuetify';
import { shallowMount, mount } from '@vue/test-utils';
import CompletionOptions from '../CompletionOptions.vue';
import { CompletionCriteriaModels } from 'shared/constants';

Vue.use(Vuetify);

Expand Down Expand Up @@ -628,7 +629,10 @@ describe('CompletionOptions', () => {
const wrapper = mount(CompletionOptions, {
propsData: {
kind: 'html5',
value: { suggested_duration: null, model: 'approx_time' },
value: {
suggested_duration: null,
model: CompletionCriteriaModels.DETERMINED_BY_RESOURCE,
},
},
});
wrapper.find({ ref: 'duration' }).vm.$emit('input', 'shortActivity');
Expand All @@ -640,7 +644,10 @@ describe('CompletionOptions', () => {
const wrapper = mount(CompletionOptions, {
propsData: {
kind: 'html5',
value: { suggested_duration: null, model: 'approx_time' },
value: {
suggested_duration: null,
model: CompletionCriteriaModels.DETERMINED_BY_RESOURCE,
},
},
});
wrapper.find({ ref: 'duration' }).vm.$emit('input', 'longActivity');
Expand All @@ -652,7 +659,10 @@ describe('CompletionOptions', () => {
const wrapper = mount(CompletionOptions, {
propsData: {
kind: 'html5',
value: { suggested_duration: null, model: 'time' },
value: {
suggested_duration: null,
model: CompletionCriteriaModels.DETERMINED_BY_RESOURCE,
},
},
});
wrapper.find({ ref: 'duration' }).vm.$emit('input', 'exactTime');
Expand All @@ -673,6 +683,23 @@ describe('CompletionOptions', () => {
});
});
});
describe(`html5`, () => {
describe(`when completion dropdown is the default value`, () => {
it(`should emit determined by resource when it is selected`, async () => {
const wrapper = mount(CompletionOptions, {
propsData: {
kind: 'html5',
value: { suggested_duration: null, model: null },
},
});
wrapper.find({ ref: 'completion' }).vm.$emit('input', 'determinedByResource');
await wrapper.vm.$nextTick();
expect(wrapper.emitted('input')[0][0].completion_criteria.model).toEqual(
CompletionCriteriaModels.DETERMINED_BY_RESOURCE
);
});
});
});
});
describe(`minutes input`, () => {
//Note: while the 'ActivityDuration' component itself is in another component,
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ djangorestframework==3.12.4
psycopg2-binary==2.9.3
django-js-reverse==0.9.1
django-registration==3.3
le-utils==0.1.41
le-utils==0.1.42
gunicorn==20.1.0
django-postmark==0.1.6
jsonfield==3.1.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ jsonschema==4.16.0
# via -r requirements.in
kombu==5.2.4
# via celery
le-utils==0.1.41
le-utils==0.1.42
# via -r requirements.in
newrelic==6.2.0.156
# via -r requirements.in
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8000,9 +8000,9 @@ known-css-properties@^0.24.0:
integrity sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==

kolibri-constants@^0.1.41:
version "0.1.41"
resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.1.41.tgz#7acf8118bc4ab2ceb3e28b807e391d46bb563ed9"
integrity sha512-cykNfZvnW8FZlpYnk3SvTUuCOGlYGwgmQbor91dpWe9z8Tb4jcZKYzIY+ZBCsjgsU1azb+R+gdqLxrdw9LgGLg==
version "0.1.42"
resolved "https://registry.yarnpkg.com/kolibri-constants/-/kolibri-constants-0.1.42.tgz#2f62a8d8b8894e5cfbd47ee6564b31018818c93f"
integrity sha512-2hUxYnzUEfhLFJO9egVSwYW8/PKob9wLeDYfB74mtIzgQ4zy6huRj3574WetK9gREi+W1Jcm7HGPsfZIFzFvrA==

"kolibri-design-system@https://github.com/learningequality/kolibri-design-system#e9a2ff34716bb6412fe99f835ded5b17345bab94":
version "1.3.0"
Expand Down