Skip to content

Commit

Permalink
Merge pull request #4270 from learningequality/unstable
Browse files Browse the repository at this point in the history
Merge unstable to hotfixes
  • Loading branch information
rtibbles authored Sep 14, 2023
2 parents ba592bd + 1a62ea9 commit b24c843
Show file tree
Hide file tree
Showing 32 changed files with 510 additions and 235 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -51,7 +51,7 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontendlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontendtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
if: ${{ needs.pre_job.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pythontest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
# Maps port 6379 on service container to the host
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up minio
run: |
docker run -d -p 9000:9000 --name minio \
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions contentcuration/automation/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions contentcuration/automation/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class AutomationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'automation'
Empty file.
3 changes: 3 additions & 0 deletions contentcuration/automation/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# from django.db import models

# Create your models here.
3 changes: 3 additions & 0 deletions contentcuration/automation/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions contentcuration/automation/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# from django.shortcuts import render

# Create your views here.
2 changes: 1 addition & 1 deletion contentcuration/contentcuration/dev_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

ROOT_URLCONF = "contentcuration.dev_urls"

INSTALLED_APPS += ("drf_yasg",)
INSTALLED_APPS += ("drf_yasg", "automation")
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<transition-group name="list-complete" tag="div">
<VCard
v-for="(item, idx) in sortedItems"
ref="questionCardRef"
:key="`question-${item.assessment_id}`"
pa-1
class="elevation-4 list-complete-item"
Expand Down Expand Up @@ -333,6 +334,17 @@
this.$analytics.trackAction('exercise_editor', 'Add', {
eventLabel: 'Question',
});
this.$nextTick(() => {
const questionCards = this.$refs['questionCardRef'];
if (questionCards?.length >= 1) {
const lastQuestionCard = questionCards[questionCards.length - 1].$el;
const editorDiv = document.getElementById('editViewId');
editorDiv.scrollTo({
top: lastQuestionCard.offsetTop,
behavior: 'smooth',
});
}
});
},
async deleteItem(itemToDelete) {
if (this.isItemActive(itemToDelete)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,6 @@
if (!this.question) {
this.openQuestion();
}
// Assessments are nested inside of a scrolling panel.
// Instead of propagating an event all the way back to
// the scrolling panel, just use scrollIntoView
// (supported by most major browsers)
if (this.$el.scrollIntoView) {
this.$el.scrollIntoView({ behaviour: 'smooth' });
}
},
methods: {
updateItem(payload) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,13 +489,18 @@
},
createNodesFromUploads(fileUploads) {
fileUploads.forEach((file, index) => {
const title = file.original_filename
.split('.')
.slice(0, -1)
.join('.');
let title;
if (file.metadata.title) {
title = file.metadata.title;
} else {
title = file.original_filename
.split('.')
.slice(0, -1)
.join('.');
}
this.createNode(
FormatPresets.has(file.preset) && FormatPresets.get(file.preset).kind_id,
{ title }
{ title, ...file.metadata }
).then(newNodeId => {
if (index === 0) {
this.selected = [newNodeId];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>

<VContainer ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
<VContainer id="editViewId" ref="editview" fluid class="pa-0 wrapper" @scroll="scroll">
<VContainer v-if="!nodeIds.length" fluid>
<VLayout justify-center align-center fill-height>
<VFlex grow class="grey--text text-xs-center title">
Expand Down
18 changes: 13 additions & 5 deletions contentcuration/contentcuration/frontend/channelEdit/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { metadataStrings, constantStrings } from 'shared/mixins';
import {
AssessmentItemTypes,
CompletionCriteriaModels,
ContentModalities,
SHORT_LONG_ACTIVITY_MIDPOINT,
CompletionDropdownMap,
} from 'shared/constants';
Expand Down Expand Up @@ -280,18 +281,20 @@ export function getCompletionDataFromNode(node) {
return;
}

const completionCriteria = node.extra_fields?.options?.completion_criteria
? JSON.parse(JSON.stringify(node.extra_fields?.options?.completion_criteria))
: null;
const extraFields = node?.extra_fields || {};
const options = extraFields?.options || {};
const completionCriteria = options?.completion_criteria || null;
const threshold = completionCriteria?.threshold || generateDefaultThreshold(node);
const model = completionCriteria?.model || defaultCompletionCriteriaModels[node.kind];
const suggestedDurationType = node.extra_fields?.suggested_duration_type;
const modality = options?.modality || null;
const suggestedDurationType = extraFields?.suggested_duration_type;
const suggestedDuration = node.suggested_duration;

return {
completionModel: model,
completionThreshold: threshold,
masteryModel: threshold?.mastery_model,
modality,
suggestedDurationType,
suggestedDuration,
};
Expand Down Expand Up @@ -323,11 +326,11 @@ export function getCompletionCriteriaLabels(node = {}, files = []) {
if (!node && !files) {
return;
}

const {
completionModel,
completionThreshold,
masteryModel,
modality,
suggestedDuration,
} = getCompletionDataFromNode(node);

Expand Down Expand Up @@ -374,6 +377,11 @@ export function getCompletionCriteriaLabels(node = {}, files = []) {
m: completionThreshold.m,
n: completionThreshold.n,
});
} else if (
masteryModel === MasteryModelsNames.DO_ALL &&
modality === ContentModalities.QUIZ
) {
labels.completion = metadataStrings.$tr('practiceQuiz');
} else {
labels.completion = constantStrings.$tr(masteryModel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
item-value="id"
:disabled="loadingChannels"
notranslate
useEllipsis
/>

<p class="font-weight-bold grey--text mb-1">
Expand Down
2 changes: 2 additions & 0 deletions contentcuration/contentcuration/frontend/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const kindToIconMap = {
channel: 'apps',
document: 'description',
exercise: 'star',
h5p: 'widgets',
html5: 'widgets',
image: 'image',
slideshow: 'photo_library',
Expand Down Expand Up @@ -205,6 +206,7 @@ export const AccessibilityCategoriesMap = {
video: ['CAPTIONS_SUBTITLES', 'AUDIO_DESCRIPTION', 'SIGN_LANGUAGE'],
exercise: ['ALT_TEXT'],
html5: ['ALT_TEXT', 'HIGH_CONTRAST'],
h5p: ['ALT_TEXT', 'HIGH_CONTRAST'],
audio: ['CAPTIONS_SUBTITLES'],
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ const FormatPresetsMap = new Map([
supplementary: false,
thumbnail: false,
subtitle: false,
display: false,
display: true,
order: 1,
kind_id: 'h5p',
allowed_formats: ['h5p'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ const LanguagesMap = new Map([
lang_direction: 'ltr',
},
],
[
'rsn',
{
id: 'rsn',
lang_code: 'rsn',
lang_subcode: null,
readable_name: 'Rwandan Sign Language',
native_name: "Amarenga y'Ikinyarwanda",
lang_direction: 'ltr',
},
],
[
'an',
{
Expand Down Expand Up @@ -198,6 +209,17 @@ const LanguagesMap = new Map([
lang_direction: 'ltr',
},
],
[
'csx',
{
id: 'csx',
lang_code: 'csx',
lang_subcode: null,
readable_name: 'Cambodian Sign Language',
native_name: 'Cambodian Sign Language',
lang_direction: 'ltr',
},
],
[
'ca',
{
Expand Down Expand Up @@ -1430,6 +1452,17 @@ const LanguagesMap = new Map([
lang_direction: 'ltr',
},
],
[
'xki',
{
id: 'xki',
lang_code: 'xki',
lang_subcode: null,
readable_name: 'Kenyan Sign Language',
native_name: 'Swahili Lugha ya ishara',
lang_direction: 'ltr',
},
],
[
'be-tara',
{
Expand Down Expand Up @@ -2564,6 +2597,18 @@ const LanguagesMap = new Map([
lang_direction: 'ltr',
},
],
[
'nsp',
{
id: 'nsp',
lang_code: 'nsp',
lang_subcode: null,
readable_name: 'Nepalese Sign Language',
native_name:
'\u0928\u0947\u092a\u093e\u0932\u0940 \u0938\u093e\u0902\u0915\u0947\u0924\u093f\u0915 \u092d\u093e\u0937\u093e',
lang_direction: 'ltr',
},
],
[
'pi',
{
Expand Down Expand Up @@ -3011,6 +3056,7 @@ export const LanguagesNames = {
AF: 'af',
AK: 'ak',
AKA: 'aka',
RSN: 'rsn',
AN: 'an',
EN_PT: 'en-PT',
IG: 'ig',
Expand All @@ -3023,6 +3069,7 @@ export const LanguagesNames = {
EN_GB: 'en-GB',
BUG: 'bug',
BXK: 'bxk',
CSX: 'csx',
CA: 'ca',
CEB: 'ceb',
CH: 'ch',
Expand Down Expand Up @@ -3135,6 +3182,7 @@ export const LanguagesNames = {
PBT: 'pbt',
SV_SE: 'sv-SE',
SV_FI: 'sv-FI',
XKI: 'xki',
BE_TARA: 'be-tara',
VI: 'vi',
TPI: 'tpi',
Expand Down Expand Up @@ -3237,6 +3285,7 @@ export const LanguagesNames = {
NEW: 'new',
NE: 'ne',
NE_NP: 'ne-NP',
NSP: 'nsp',
PI: 'pi',
BH: 'bh',
BHO: 'bho',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
return this.$tr('exercise');
case 'document':
return this.$tr('document');
case 'h5p':
return this.$tr('html5');
case 'html5':
return this.$tr('html5');
default:
Expand Down
Loading

0 comments on commit b24c843

Please sign in to comment.