Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge down hotfixes to unstable, with string translations and fixes #3747

Merged
merged 20 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
955885e
Merge pull request #3652 from learningequality/hotfixes
bjester Sep 19, 2022
62fcfc2
Merge branch 'master' into hotfixes
bjester Oct 17, 2022
56769c4
download the files into the correct place
nucleogenesis Oct 17, 2022
69c388b
Merge pull request #3742 from nucleogenesis/t8ns-from-unstable
bjester Oct 17, 2022
9d3f2e4
Remove files causing confusing structure
bjester Oct 17, 2022
7a4abba
Convert CSV into JSON
bjester Oct 17, 2022
0356470
Merge pull request #3743 from bjester/translations-fixup
rtibbles Oct 17, 2022
7807c85
Fix i18n induced issues with learning activity icons.
rtibbles Oct 18, 2022
704285d
Resolve RTL dropdown issues
bjester Oct 19, 2022
21a778b
Merge pull request #3749 from rtibbles/i18nicons
bjester Oct 19, 2022
69264f0
Return empty string for class instead of null
bjester Oct 19, 2022
15b9629
Merge pull request #3756 from bjester/rtl-dropdowns
marcellamaki Oct 20, 2022
d4f2de2
Fix change errors not saving and skip errored or disallowed changes w…
bjester Oct 20, 2022
8ccff73
Resolve issues with handling of M/N values
bjester Oct 20, 2022
0f607d9
Allow learner_managed as null so it can be deleted
bjester Oct 20, 2022
59c3e83
Add demo server URL to catalog response
bjester Oct 21, 2022
22f4139
Learning Activity and Completion Criteria logic on when bulk editable
bjester Oct 21, 2022
a9c6e04
Merge pull request #3762 from bjester/demo-server-url
rtibbles Oct 24, 2022
bd43621
Merge pull request #3763 from bjester/bulk-allowed
rtibbles Oct 24, 2022
419991f
Merge pull request #3760 from bjester/learner-managed
rtibbles Oct 24, 2022
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 @@ -167,7 +167,8 @@
},
methods: {
treeItemStyle(item) {
return this.nested ? { paddingLeft: `${item.level * 24}px` } : {};
const rule = this.$isRTL ? 'paddingRight' : 'paddingLeft';
return this.nested ? { [rule]: `${item.level * 24}px` } : {};
},
add(value) {
this.selected = [...this.selected, value];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

<script>

import get from 'lodash/get';
import MasteryCriteriaGoal from './MasteryCriteriaGoal';
import ActivityDuration from './ActivityDuration.vue';
import MasteryCriteriaMofNFields from './MasteryCriteriaMofNFields';
Expand Down Expand Up @@ -163,11 +164,8 @@
computed: {
showMasteryCriteriaGoalDropdown() {
if (this.kind === ContentKindsNames.EXERCISE) {
if (this.value.modality === ContentModalities.QUIZ) {
//this ensures that anytime the completion dropdown is practice quiz
return false;
}
return true;
//this ensures that anytime the completion dropdown is practice quiz
return this.value.modality !== ContentModalities.QUIZ;
}
return false;
},
Expand Down Expand Up @@ -392,8 +390,8 @@
model: CompletionCriteriaModels.MASTERY,
threshold: {
mastery_model: threshold.mastery_model,
m: this.value.threshold.m || this.m,
n: this.value.threshold.n || this.n,
m: get(this.value, 'threshold.m') || this.m,
n: get(this.value, 'threshold.n') || this.n,
},
};
} else {
Expand All @@ -406,8 +404,6 @@
},
};
}
this.m = (this.value.threshold ? this.value.threshold.m : null) || this.m;
this.n = (this.value.threshold ? this.value.threshold.n : null) || this.n;
this.handleInput(update);
},
},
Expand Down Expand Up @@ -435,35 +431,33 @@
},
masteryModelItem: {
get() {
if (!this.value.threshold) {
return { m: null, n: null };
}

if (this.value.threshold.mastery_model !== MasteryModelsNames.M_OF_N) {
if (get(this.value, 'threshold.mastery_model') !== MasteryModelsNames.M_OF_N) {
return {
m: this.value.threshold.m,
n: this.value.threshold.n,
m: null,
n: null,
};
}
return {
m: this.value.threshold.m ? this.value.threshold.m : this.m,
n: this.value.threshold.n ? this.value.threshold.n : this.n,
m: get(this.value, 'threshold.m') || this.m,
n: get(this.value, 'threshold.n') || this.n,
};
},
set(threshold) {
this.m = threshold.m;
this.n = threshold.n;
this.m = get(threshold, 'm') || this.m;
this.n = get(threshold, 'n') || this.n;

let update = {};
update.completion_criteria = {
const mastery_model = get(this.value, 'threshold.mastery_model');
const completion_criteria = {
model: CompletionCriteriaModels.MASTERY,
threshold: {
mastery_model: this.value.threshold.mastery_model,
m: threshold.m,
n: threshold.n,
mastery_model,
},
};
this.handleInput(update);
if (mastery_model === MasteryModelsNames.M_OF_N) {
completion_criteria.threshold.m = this.m;
completion_criteria.threshold.n = this.n;
}
this.handleInput({ completion_criteria });
},
},
isLongActivity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<LearningActivityOptions
ref="learning_activities"
v-model="contentLearningActivities"
:disabled="isTopic"
:disabled="anyIsTopic"
@focus="trackClick('Learning activities')"
/>
<!-- Level -->
Expand Down Expand Up @@ -125,7 +125,7 @@
</VLayout>

<!-- Completion section for all resources -->
<VLayout v-if="!isTopic" row wrap class="section">
<VLayout v-if="!anyIsTopic && allSameKind" row wrap class="section">
<VFlex xs12>
<h1 class="subheading">
{{ $tr('completionLabel') }}
Expand All @@ -143,7 +143,7 @@
v-model="completionAndDuration"
:kind="firstNode.kind"
:fileDuration="fileDuration"
:required="!isDocument"
:required="!anyIsDocument || !allSameKind"
/>
</VFlex>
</VLayout>
Expand Down Expand Up @@ -528,9 +528,22 @@
allResources() {
return !this.nodes.some(node => node.kind === ContentKindsNames.TOPIC);
},
allSameKind() {
const kind = this.firstNode.kind;
return !this.nodes.some(node => node.kind !== kind);
},
anyIsDocument() {
return this.nodes.some(n => n.kind === ContentKindsNames.DOCUMENT);
},
anyIsTopic() {
return this.nodes.some(n => n.kind === ContentKindsNames.TOPIC);
},
isImported() {
return isImportedContent(this.firstNode);
},
newContent() {
return !this.nodes.some(n => n[NEW_OBJECT]);
},
importedChannelLink() {
return importedChannelLink(this.firstNode, this.$router);
},
Expand Down Expand Up @@ -706,15 +719,6 @@
videoSelected() {
return this.oneSelected && this.firstNode.kind === ContentKindsNames.VIDEO;
},
newContent() {
return !this.nodes.some(n => n[NEW_OBJECT]);
},
isDocument() {
return this.firstNode.kind === ContentKindsNames.DOCUMENT;
},
isTopic() {
return this.firstNode.kind === ContentKindsNames.TOPIC;
},
},
watch: {
nodes: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<script>

import { getMasteryModelValidators, translateValidator } from '../../../shared/utils/validation';
import { getMasteryModelValidators, translateValidator } from 'shared/utils/validation';
import MasteryModels, { MasteryModelsList } from 'shared/leUtils/MasteryModels';
import { constantsTranslationMixin } from 'shared/mixins';
import DropdownWrapper from 'shared/views/form/DropdownWrapper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
getMasteryModelMValidators,
getMasteryModelNValidators,
translateValidator,
} from '../../../shared/utils/validation';
import MasteryModels from 'shared/leUtils/MasteryModels'; // MasteryModelsNames, // MasteryModelsList,
} from 'shared/utils/validation';
import MasteryModels from 'shared/leUtils/MasteryModels';
import { constantsTranslationMixin } from 'shared/mixins';

export default {
Expand Down Expand Up @@ -108,19 +108,15 @@
return this.value && this.value.m;
},
set(value) {
value = Number(value);
// Make sure n is always greater than or equal to m
this.handleInput(value > this.nValue ? { m: value, n: value } : { m: value });
this.handleInput({ m: Number(value) });
},
},
nValue: {
get() {
return this.value && this.value.n;
},
set(value) {
value = Number(value);
// Make sure m is always less than or equal to n
this.handleInput(value < this.mValue ? { m: value, n: value } : { n: value });
this.handleInput({ n: Number(value) });
},
},
mRules() {
Expand All @@ -133,10 +129,15 @@
},
},
methods: {
handleInput(newValue) {
handleInput(update) {
// Don't emit input events unless we're sure we should
if (!this.showMofN) {
return;
}

let data = {
...this.value,
...newValue,
...update,
};
this.$emit('input', data);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,6 @@ function generateContentNodeData({
}
if (extra_fields !== NOVALUE) {
contentNodeData.extra_fields = contentNodeData.extra_fields || {};
if (extra_fields.mastery_model) {
contentNodeData.extra_fields.mastery_model = extra_fields.mastery_model;
}
if (extra_fields.m) {
contentNodeData.extra_fields.m = extra_fields.m;
}
if (extra_fields.n) {
contentNodeData.extra_fields.n = extra_fields.n;
}
if (extra_fields.randomize !== undefined) {
contentNodeData.extra_fields.randomize = extra_fields.randomize;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,16 @@ export default function mergeAllChanges(changes, flatten = false, changesToSync
if (!('rev' in change) || typeof change.rev === 'undefined') {
console.error('This change has no `rev`:', change);
throw new Error('Cannot determine the correct order for a change with no `rev`.');
} else if (change.rev <= lastRev) {
} else if (lastRev && change.rev <= lastRev) {
console.error("These changes aren't ordered by `rev`:", changes);
throw new Error('Cannot merge changes unless they are ordered by `rev`.');
}

// Skip the change if the change errored or was disallowed
if (change.disallowed || (change.errors && change.errors.length > 0)) {
continue;
}

lastRev = change.rev;

// Ignore changes initiated by non-Resource registered tables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function handleErrors(response) {
// both with any errors and the results of any merging that happened prior
// to the sync operation being called
return db[CHANGES_TABLE].where('server_rev')
.anyOf(Object.keys(errorMap))
.anyOf(Object.keys(errorMap).map(Number))
.modify(obj => {
return Object.assign(obj, errorMap[obj.server_rev]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,17 @@
},
methods: {
icon(activity) {
return getLearningActivityIcon(this.text(activity));
return getLearningActivityIcon(activity);
},
text(activity) {
if (this.isTopic) {
return this.$tr('topic');
} else if (activity == 'multiple') {
if (activity === 'multiple') {
return this.$tr('multipleLearningActivities');
}
return this.translateMetadataString(camelCase(activity));
},
},
$trs: {
multipleLearningActivities: 'Multiple learning activities',
topic: 'Folder',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
top: this.top,
maxHeight: this.menuHeight,
lazy: true,
contentClass: this.$isRTL ? 'forceRTLMenu' : '',
};
},
},
Expand Down Expand Up @@ -91,3 +92,16 @@
};

</script>
<style>

/* According to the documentation, Vuetify supposedly supports a `right` prop to position the menu
on the right side, but there isn't any code that actually does this. So when using an RTL
language, this class will be applied and these will get flipped, because our intention is
left:auto and right:0
*/
.forceRTLMenu {
left: 0 !important;
right: auto !important;
}

</style>
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export function getContentKindIcon(kind, isEmpty = false) {
}

export function getLearningActivityIcon(activity) {
if (activity == 'Explore') {
if (activity.toLowerCase() === 'explore') {
return 'interactShaded';
} else if (activity == 'Multiple learning activities') {
} else if (activity === 'multiple') {
return 'allActivities';
} else {
return `${camelCase(activity) + 'Solid'}`;
Expand Down
1 change: 1 addition & 0 deletions contentcuration/contentcuration/viewsets/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ class CatalogViewSet(ReadOnlyValuesViewset):
"count",
"public",
"last_published",
"demo_server_url",
)

def get_queryset(self):
Expand Down
2 changes: 1 addition & 1 deletion contentcuration/contentcuration/viewsets/contentnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def update(self, instance, validated_data):
class CompletionCriteriaSerializer(JSONFieldDictSerializer):
threshold = ThresholdField(allow_null=True)
model = CharField()
learner_managed = BooleanField(required=False)
learner_managed = BooleanField(required=False, allow_null=True)

def update(self, instance, validated_data):
instance = super(CompletionCriteriaSerializer, self).update(instance, validated_data)
Expand Down
Loading