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 into unstable #4245

Merged
merged 91 commits into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
761a532
Merge pull request #4067 from learningequality/hotfixes
bjester May 10, 2023
a2a445e
Switch unsynced change monitoring to a liveQuery to further remove De…
rtibbles Jun 9, 2023
6960803
Remove resource based listeners in favour of liveQuery.
rtibbles Jun 9, 2023
d938893
Adds a basic global saving indicator to the channel edit page.
rtibbles Jun 9, 2023
91e8a5c
Handle side-loading node data separate APIs
bjester Jun 13, 2023
aa304a8
Remove console.log
bjester Jun 13, 2023
eb5fd8c
Merge pull request #4137 from bjester/import-search-load
rtibbles Jun 13, 2023
d6ed795
Catch any and all errors in exporting channels.
rtibbles Jun 13, 2023
07b9d21
Merge pull request #4139 from rtibbles/public_api_channels_catch_all_…
bjester Jun 13, 2023
57e9564
Proper updating of resource counts when a change occurs
bjester Jun 6, 2023
07d3af9
Fix duplicate coach content icon for resources
bjester Jun 6, 2023
1f54353
Fix affected tests for aggregate counts
bjester Jun 6, 2023
2cbb3f9
Keep applying remote changes in the same lock as sync for now
bjester Jun 13, 2023
fd90b26
Track client support for web locks API
bjester Jun 13, 2023
49aa5b0
Add cleanup behaviour for global subscriptions.
rtibbles Jun 13, 2023
23ae252
Only show saving indicator when not offline.
rtibbles Jun 13, 2023
115a0e6
Merge pull request #4126 from rtibbles/display_sync_changes
marcellamaki Jun 13, 2023
38d8733
Add regression test and fix for double JSONed options.
rtibbles Jun 14, 2023
c79e2e1
Merge pull request #4146 from rtibbles/no_string_json
bjester Jun 16, 2023
fc2253b
Merge pull request #4113 from bjester/take2-count-counts
rtibbles Jun 16, 2023
4af8e7d
Fixes error that appears in the console on drag nested resource to to…
akolson Jun 16, 2023
0ac48fd
Fixes error that appears in the console on drag nested resource to to…
akolson Jun 16, 2023
4f9fc43
Fixes css styling
akolson Jun 16, 2023
56af7d2
Fixes incorrect folder order/layout for folders with long titles
LianaHarris360 Jun 19, 2023
8478e0c
Linting fixes
LianaHarris360 Jun 19, 2023
2ecd7c6
Streamlines use of oldObj.parent
akolson Jun 16, 2023
f5f61b9
Merge pull request #4152 from LianaHarris360/incorrect-folder-order
LianaHarris360 Jun 20, 2023
7efe06a
Merge pull request #4149 from akolson/fix-undo-button
bjester Jun 20, 2023
433e2a9
Fix issues when options is an object, not JSON string
bjester Jun 14, 2023
fd6ef23
Change page size options and default; enforce page size
bjester Jun 14, 2023
e5ca5c9
Hacks for unloaded nodes just in case
bjester Jun 14, 2023
fe3d866
Only load published nodes in channel browsing
bjester Jun 14, 2023
ee69483
Tweaks to import search public api usage
bjester Jun 19, 2023
1f0523c
Update tests to prevent strings in JSON.
rtibbles Jun 20, 2023
c79d3f2
Fix previewing exercises in import search
bjester Jun 20, 2023
7a16e1d
Further reduce default page size
bjester Jun 20, 2023
7700c2d
Defensive check on mastery_model JSON
bjester Jun 20, 2023
9ea9cdf
Prevent mapping of tags over 30 chars
bjester Jun 19, 2023
5a23182
Configure channel builder to optionally add bad data
bjester Jun 20, 2023
2eece7e
Allow export command to be run without channel existing locally
bjester Jun 20, 2023
a04539e
Prevent publishing from modifying published options.
rtibbles Jun 20, 2023
63693d3
Don't allow adding nodes to non-topics
bjester Jun 20, 2023
b995463
Merge pull request #4153 from bjester/public-api-migration
rtibbles Jun 20, 2023
bcabc71
Merge pull request #4158 from rtibbles/more_no_string_json
bjester Jun 20, 2023
da46564
Merge pull request #4156 from bjester/fix-json-issue-2
bjester Jun 21, 2023
b90feb7
Skip exercises with missing or broken mastery criteria
bjester Jun 23, 2023
dfd6536
Update change tracker to re-raise; update copy operation to log excep…
bjester Jun 23, 2023
5525b86
Fix broken 'Go to location' link
bjester Jun 23, 2023
9b2aff0
Adds defensive check to prevent failing drops
akolson Jun 16, 2023
3084d31
Merge pull request #4175 from bjester/go-to-location
bjester Jun 26, 2023
730c973
Add ancestor annotation to kolibri_public export mapper.
rtibbles Jun 26, 2023
8a80874
Merge pull request #4178 from rtibbles/ancestor_annotation
bjester Jun 29, 2023
893525e
Merge pull request #4174 from bjester/publish-errors
bjester Jun 29, 2023
87e988a
Refactor the default completion and duration content completion optio…
marcellamaki Jul 2, 2023
b6e295f
Add tests, PR feedback
marcellamaki Jul 3, 2023
a47d924
remove stray logs
marcellamaki Jul 4, 2023
3155ca9
Merge pull request #4182 from marcellamaki/incomplete-completion-meta…
marcellamaki Jul 4, 2023
b16dd11
Merge branch 'master' into hotfixes
bjester Jul 5, 2023
51b61bd
Prevent source edits for copied/imported resources
akolson Jul 5, 2023
aeb0c2e
Bump grpcio from 1.51.1 to 1.53.0
dependabot[bot] Jul 5, 2023
80d33c6
Fix language ignorance for public API
vkWeb Jul 6, 2023
355eca9
[#4193][#4194] Apply defaults to details to avoid undefined errors
bjester Jul 6, 2023
7d81e1b
[#4195] Defensive check against deleted attr
bjester Jul 6, 2023
1f74be8
Merge pull request #4150 from akolson/fixes-drag-error-message
bjester Jul 6, 2023
7492935
Create computed prop for deleted
bjester Jul 7, 2023
95f09af
[#4200] Defensiveness against ZIM content kind, and .icon
bjester Jul 7, 2023
07a4e37
[#4206] Add missing image causing PDF generation to fail
bjester Jul 7, 2023
b2793ff
Fix Vue complaints about undefined 'name' used in template
bjester Jul 7, 2023
118894b
[#4200] Fix icon access in storage settings view
bjester Jul 7, 2023
5139611
Close drawer when opening language modal
bjester Jul 7, 2023
09dc992
uses instead of '!'=8084
akolson Jul 8, 2023
a0bda29
Merge pull request #4189 from akolson/prevent-source-edits
bjester Jul 10, 2023
659b0eb
Remove public api export from deploy-migrate since it has run on prod
bjester Jul 10, 2023
de45841
Merge pull request #4210 from bjester/remove-public-api-export
rtibbles Jul 10, 2023
178d276
Merge pull request #4199 from bjester/bjester/v2023.07.05-patches/1
bjester Jul 10, 2023
8030319
Merge pull request #4207 from bjester/bjester/v2023.07.05-patches/2
bjester Jul 10, 2023
975a571
Merge pull request #4192 from learningequality/dependabot/pip/grpcio-…
rtibbles Jul 12, 2023
3e7be2c
Merge pull request #4198 from vkWeb/ignore-lang
rtibbles Jul 18, 2023
a10be69
Handle errors in publishing better by cleaning up database connections.
rtibbles Jul 19, 2023
ab6f527
Add test case for publishing an empty channel.
rtibbles Jul 19, 2023
0b80f79
Add special handling of publishes that cannot go ahead.
rtibbles Jul 19, 2023
14b89ea
Handle tear down better to avoid errors.
rtibbles Jul 19, 2023
77dd2cd
Prevent errors when creating already existing tag through model entries.
rtibbles Jul 19, 2023
1d78f3b
Fix bitmask filtering by multiple labels for AND rather than OR behav…
rtibbles Jul 19, 2023
1e3e05b
Merge pull request #4231 from rtibbles/empty_channels
bjester Jul 19, 2023
947e14c
Merge pull request #4233 from rtibbles/AND_NOT_OR
rtibbles Jul 19, 2023
1109117
Add regression test for duplicate tags edge case.
rtibbles Jul 19, 2023
ae16389
Merge pull request #4232 from rtibbles/tag_me_in
rtibbles Jul 19, 2023
9a48ae4
Fix undo of copying
vkWeb Jul 25, 2023
16881b7
Merge pull request #4244 from vkWeb/undo-copy-man
bjester Jul 25, 2023
a0d657a
Resolve merge conflicts in package.json
bjester Jul 25, 2023
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
root = true

[*]
max_line_length = 100

[*.js]
indent_size = 2

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ migrate:
# 4) Remove the management command from this `deploy-migrate` recipe
# 5) Repeat!
deploy-migrate:
python contentcuration/manage.py export_channels_to_kolibri_public
echo "Nothing to do here!"

contentnodegc:
python contentcuration/manage.py garbage_collect
Expand Down
6 changes: 5 additions & 1 deletion contentcuration/contentcuration/db/models/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ def _copy_tags(self, source_copy_id_map):
tag_id_map[tag.id] = new_tag.id
tags_to_create.append(new_tag)

# TODO: Can cleanup the above and change the below to use ignore_conflicts=True
ContentTag.objects.bulk_create(tags_to_create)

mappings_to_create = [
Expand All @@ -499,7 +500,10 @@ def _copy_tags(self, source_copy_id_map):
for mapping in node_tags_mappings
]

self.model.tags.through.objects.bulk_create(mappings_to_create)
# In the case that we are copying a node that is in the weird state of having a tag
# that is duplicated (with a channel tag and a null channel tag) this can cause an error
# so we ignore conflicts here to ignore the duplicate tags.
self.model.tags.through.objects.bulk_create(mappings_to_create, ignore_conflicts=True)

def _copy_assessment_items(self, source_copy_id_map):
from contentcuration.models import File
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@
channel() {
return this.getChannel(this.channelId);
},
name() {
return this.channel.name;
},
searchChannelEditorsLink() {
return {
name: RouteNames.USERS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</template>
<LoadingText v-if="loading" absolute />
<VCardText v-else>
<Banner error :value="channel.deleted" class="mb-4">
<Banner error :value="isDeleted" class="mb-4">
This channel has been deleted
</Banner>
<VTabsItems v-model="tab">
Expand Down Expand Up @@ -102,6 +102,9 @@
channel() {
return this.getChannel(this.channelId);
},
isDeleted() {
return this.channel && Boolean(this.channel?.deleted);
},
channelWithDetails() {
if (!this.channel || !this.details) {
return {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
importedChannelLink,
secondsToHms,
getCompletionCriteriaLabels,
getCompletionDataFromNode,
} from '../utils';
import router from '../router';
import { RouteNames } from '../constants';
Expand Down Expand Up @@ -475,6 +476,76 @@ describe('channelEdit utils', () => {
});

describe(`getCompletionCriteriaLabels`, () => {
describe(`setting default values for completion and duration`, () => {
describe(`for audio and video content`, () => {
it(`returns 'When time spent is equal to duration' completion label and duration label equal to the file length in hh:mm:ss format`, () => {
expect(
getCompletionCriteriaLabels(
{
extra_fields: {
options: {},
},
kind: 'audio',
},
[{ duration: 100 }]
)
).toEqual({
completion: 'When time spent is equal to duration',
duration: '01:40',
});
});
it(`returns 'When time spent is equal to duration' completion label and duration label equal to the file length in hh:mm:ss format`, () => {
expect(
getCompletionCriteriaLabels(
{
extra_fields: {
options: {},
},
kind: 'video',
},
[{ duration: 100 }]
)
).toEqual({
completion: 'When time spent is equal to duration',
duration: '01:40',
});
});
});
describe(`for documents`, () => {
it(`returns 'Viewed in its entirety' completion label and empty duration label`, () => {
expect(
getCompletionCriteriaLabels(
{
extra_fields: {
options: {},
},
kind: 'document',
},
[]
)
).toEqual({
completion: 'Viewed in its entirety',
duration: '-',
});
});
});
describe(`for exercises`, () => {
it(`sets the Completion Criteria model to 'mastery'`, () => {
expect(
getCompletionDataFromNode(
{
extra_fields: {
options: {},
},
kind: 'exercise',
},
[]
).completionModel
).toEqual('mastery');
});
});
});

describe(`for 'reference' completion criteria`, () => {
it(`returns 'Reference material' completion label and empty duration label`, () => {
expect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
v-on="on"
@click="clickItem(action)"
>
<Icon :color="iconColor(action)">
<Icon v-if="config[action] && config[action].icon" :color="iconColor(action)">
{{ config[action].icon }}
</Icon>
</VBtn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
>
{{ category(node.categories) }}
</span>
<span v-if="(isTopic && node.coach_count) || isCoach">
<span v-if="isTopic && node.coach_count">
<!-- for each learning activity -->
<VTooltip bottom lazy>
<template #activator="{ on }">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ResourcePanel
:nodeId="nodeId"
:channelId="channelId"
:useRouting="useRouting"
@close="$emit('close')"
>
<template #navigation>
Expand Down Expand Up @@ -66,6 +67,10 @@
type: Boolean,
default: true,
},
useRouting: {
type: Boolean,
default: true,
},
},
methods: {
// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
>
<VTab
class="px-2"
:to="{ query: { tab: 'questions' } }"
exact
@change="tab = 'questions'"
>
{{ $tr('questions') }}
<Icon
Expand All @@ -90,8 +90,8 @@
</VTab>
<VTab
class="px-2"
:to="{ query: { tab: 'details' } }"
exact
@change="tab = 'details'"
>
{{ $tr('details') }}
<Icon
Expand Down Expand Up @@ -587,11 +587,16 @@
type: Boolean,
default: false,
},
useRouting: {
type: Boolean,
default: true,
},
},
data() {
return {
loading: false,
showAnswers: false,
currentTab: 'details',
};
},
computed: {
Expand All @@ -609,7 +614,7 @@
return getCompletionCriteriaLabels(this.node).completion;
},
duration() {
return getCompletionCriteriaLabels(this.node).duration;
return getCompletionCriteriaLabels(this.node, this.files).duration;
},
files() {
return sortBy(this.getContentNodeFiles(this.nodeId), f => f.preset.order);
Expand All @@ -619,6 +624,10 @@
if (!this.isExercise) {
return;
}
if (!this.useRouting) {
this.currentTab = value;
return;
}
// If viewing an exercise, we need to synchronize the the route's
// query params with the 'tab' value
const newRoute = { query: { tab: value } };
Expand All @@ -629,8 +638,8 @@
}
},
get() {
if (!this.isExercise) {
return 'details';
if (!this.isExercise || !this.useRouting) {
return this.currentTab;
}
return this.$route.query.tab || 'questions';
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
<script>

import get from 'lodash/get';
import {
defaultCompletionCriteriaModels,
defaultCompletionCriteriaThresholds,
CompletionOptionsDropdownMap,
completionCriteriaToDropdownMap,
} from '../../utils';
import MasteryCriteriaMofNFields from './MasteryCriteriaMofNFields';
import ActivityDuration from './ActivityDuration.vue';
import MasteryCriteriaGoal from './MasteryCriteriaGoal';
Expand All @@ -125,59 +131,6 @@
const DEFAULT_SHORT_ACTIVITY = 600;
const DEFAULT_LONG_ACTIVITY = 3000;

const defaultCompletionCriteriaModels = {
[ContentKindsNames.VIDEO]: CompletionCriteriaModels.TIME,
[ContentKindsNames.AUDIO]: CompletionCriteriaModels.TIME,
[ContentKindsNames.DOCUMENT]: CompletionCriteriaModels.PAGES,
[ContentKindsNames.H5P]: CompletionCriteriaModels.DETERMINED_BY_RESOURCE,
[ContentKindsNames.HTML5]: CompletionCriteriaModels.APPROX_TIME,
[ContentKindsNames.EXERCISE]: CompletionCriteriaModels.MASTERY,
};

const defaultCompletionCriteriaThresholds = {
// Audio and Video threshold defaults are dynamic based
// on the duration of the file itself.
[ContentKindsNames.DOCUMENT]: '100%',
[ContentKindsNames.HTML5]: 300,
// We cannot set an automatic default threshold for exercises.
};

const completionCriteriaToDropdownMap = {
[CompletionCriteriaModels.TIME]: CompletionDropdownMap.completeDuration,
[CompletionCriteriaModels.APPROX_TIME]: CompletionDropdownMap.completeDuration,
[CompletionCriteriaModels.PAGES]: CompletionDropdownMap.allContent,
[CompletionCriteriaModels.DETERMINED_BY_RESOURCE]: CompletionDropdownMap.determinedByResource,
[CompletionCriteriaModels.MASTERY]: CompletionDropdownMap.goal,
[CompletionCriteriaModels.REFERENCE]: CompletionDropdownMap.reference,
};

const CompletionOptionsDropdownMap = {
[ContentKindsNames.DOCUMENT]: [
CompletionDropdownMap.allContent,
CompletionDropdownMap.completeDuration,
CompletionDropdownMap.reference,
],
[ContentKindsNames.EXERCISE]: [CompletionDropdownMap.goal, CompletionDropdownMap.practiceQuiz],
[ContentKindsNames.HTML5]: [
CompletionDropdownMap.completeDuration,
CompletionDropdownMap.determinedByResource,
CompletionDropdownMap.reference,
],
[ContentKindsNames.H5P]: [
CompletionDropdownMap.determinedByResource,
CompletionDropdownMap.completeDuration,
CompletionDropdownMap.reference,
],
[ContentKindsNames.VIDEO]: [
CompletionDropdownMap.completeDuration,
CompletionDropdownMap.reference,
],
[ContentKindsNames.AUDIO]: [
CompletionDropdownMap.completeDuration,
CompletionDropdownMap.reference,
],
};

export default {
name: 'CompletionOptions',
components: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
ref="author"
:items="authors"
:label="$tr('authorLabel')"
:readonly="disableAuthEdits"
:disabled="disableSourceEdits"
maxlength="200"
counter
autoSelectFirst
Expand All @@ -267,7 +267,7 @@
ref="provider"
:items="providers"
:label="$tr('providerLabel')"
:readonly="disableAuthEdits"
:disabled="disableSourceEdits"
maxlength="200"
counter
:placeholder="getPlaceholder('provider')"
Expand All @@ -288,7 +288,7 @@
ref="aggregator"
:items="aggregators"
:label="$tr('aggregatorLabel')"
:readonly="disableAuthEdits"
:disabled="disableSourceEdits"
maxlength="200"
counter
autoSelectFirst
Expand All @@ -309,7 +309,7 @@
ref="license"
v-model="licenseItem"
:required="isUnique(license) && isUnique(license_description) && !disableAuthEdits"
:readonly="disableAuthEdits"
:disabled="disableSourceEdits"
:placeholder="getPlaceholder('license')"
:descriptionPlaceholder="getPlaceholder('license_description')"
@focus="trackClick('License')"
Expand All @@ -328,7 +328,7 @@
:rules="copyrightHolderRules"
:placeholder="getPlaceholder('copyright_holder')"
autoSelectFirst
:readonly="disableAuthEdits"
:disabled="disableSourceEdits"
box
:value="copyright_holder && copyright_holder.toString()"
@input.native="(e) => (copyright_holder = e.srcElement.value)"
Expand Down Expand Up @@ -658,6 +658,9 @@
disableAuthEdits() {
return this.nodes.some(node => node.freeze_authoring_data);
},
disableSourceEdits() {
return this.disableAuthEdits || this.isImported;
},
detectedImportText() {
const count = this.nodes.filter(node => node.freeze_authoring_data).length;
return this.$tr('detectedImportText', { count });
Expand Down
Loading