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
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 fix_exercise_extra_fields
echo "Nothing to do here!"

contentnodegc:
python contentcuration/manage.py garbage_collect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const LanguagesMap = new Map([
lang_subcode: null,
readable_name: 'Brahui',
native_name: 'Brahui',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -1130,7 +1130,7 @@ const LanguagesMap = new Map([
lang_subcode: null,
readable_name: 'Northern Pashto',
native_name: 'Northern Pashto',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -1471,7 +1471,7 @@ const LanguagesMap = new Map([
lang_subcode: null,
readable_name: 'Southern Balochi',
native_name: 'Southern Balochi',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -1626,7 +1626,7 @@ const LanguagesMap = new Map([
lang_subcode: null,
readable_name: 'Uighur; Uyghur',
native_name: 'Uy\u01a3urq\u0259, \u0626\u06c7\u064a\u063a\u06c7\u0631\u0686\u06d5\u200e',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -2540,6 +2540,17 @@ const LanguagesMap = new Map([
lang_direction: 'rtl',
},
],
[
'prs',
{
id: 'prs',
lang_code: 'prs',
lang_subcode: null,
readable_name: 'Dari',
native_name: '\u062f\u0631\u06cc',
lang_direction: 'rtl',
},
],
[
'arq',
{
Expand Down Expand Up @@ -2604,7 +2615,7 @@ const LanguagesMap = new Map([
readable_name: 'Kashmiri',
native_name:
'\u0915\u0936\u094d\u092e\u0940\u0930\u0940, \u0643\u0634\u0645\u064a\u0631\u064a\u200e',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -2740,7 +2751,7 @@ const LanguagesMap = new Map([
readable_name: 'Sindhi',
native_name:
'\u0938\u093f\u0928\u094d\u0927\u0940, \u0633\u0646\u068c\u064a\u060c \u0633\u0646\u062f\u06be\u06cc\u200e',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -2784,7 +2795,7 @@ const LanguagesMap = new Map([
lang_subcode: null,
readable_name: 'Punjabi',
native_name: '\u0a2a\u0a70\u0a1c\u0a3e\u0a2c\u0a40',
lang_direction: 'ltr',
lang_direction: 'rtl',
},
],
[
Expand Down Expand Up @@ -3390,6 +3401,7 @@ export const LanguagesNames = {
HE: 'he',
UR: 'ur',
AR: 'ar',
PRS: 'prs',
ARQ: 'arq',
FA: 'fa',
PS: 'ps',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const MasteryModels = new Set([
'do_all',
'm_of_n',
'pre_post_test',
'num_correct_in_a_row_2',
'num_correct_in_a_row_3',
'num_correct_in_a_row_5',
Expand All @@ -15,6 +16,7 @@ export const MasteryModelsList = Array.from(MasteryModels);
export const MasteryModelsNames = {
DO_ALL: 'do_all',
M_OF_N: 'm_of_n',
PRE_POST_TEST: 'pre_post_test',
NUM_CORRECT_IN_A_ROW_2: 'num_correct_in_a_row_2',
NUM_CORRECT_IN_A_ROW_3: 'num_correct_in_a_row_3',
NUM_CORRECT_IN_A_ROW_5: 'num_correct_in_a_row_5',
Expand Down
28 changes: 28 additions & 0 deletions contentcuration/contentcuration/tests/test_contentnodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,27 @@ def test_sync_after_no_changes(self):
)
self._assert_same_files(orig_video, cloned_video)

def test_sync_but_incomplete(self):
orig_video, cloned_video = self._setup_original_and_deriative_nodes()
orig_video.license_id = None
orig_video.mark_complete()
self.assertFalse(orig_video.complete)
orig_video.save()

self.assertTrue(cloned_video.complete)

sync_node(
cloned_video,
sync_titles_and_descriptions=True,
sync_resource_details=True,
sync_files=True,
sync_assessment_items=True,
)

self.assertIsNotNone(cloned_video.license_id)
cloned_video.mark_complete()
self.assertTrue(cloned_video.complete)

def test_sync_with_subs(self):
orig_video, cloned_video = self._setup_original_and_deriative_nodes()
self._add_subs_to_video_node(orig_video, "fr")
Expand Down Expand Up @@ -868,6 +889,13 @@ def _create_video_node(self, title, parent, withsubs=False):
node_id="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
)
video_node = testdata.node(data, parent=parent)
video_node.license_id = 9 # Special Permissions
video_node.license_description = "Special permissions for testing"
video_node.copyright_holder = "LE"
# ensure the node is complete according to our logic
video_node.mark_complete()
self.assertTrue(video_node.complete)
video_node.save()

if withsubs:
self._add_subs_to_video_node(video_node, "fr")
Expand Down
9 changes: 6 additions & 3 deletions contentcuration/contentcuration/utils/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ def sync_node(
sync_assessment_items=False,
):
original_node = node.get_original_node()
if not original_node.complete:
logging.warning(
f"Refusing to sync node {node.pk} from incomplete source node: {original_node.pk}"
)
return node
if original_node.node_id != node.node_id: # Only update if node is not original
logging.info(
"----- Syncing: {} from {}".format(
node.title, original_node.get_channel().name
)
f"----- Syncing: {node.title} from {original_node.get_channel().name}"
)
if sync_titles_and_descriptions:
fields = [
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ djangorestframework==3.15.1
psycopg2-binary==2.9.10
django-js-reverse==0.10.2
django-registration==3.4
le-utils==0.2.14
le-utils==0.2.16
gunicorn==23.0.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 @@ -162,7 +162,7 @@ language-data==1.3.0
# via langcodes
latex2mathml==3.78.0
# via -r requirements.in
le-utils==0.2.14
le-utils==0.2.16
# via -r requirements.in
marisa-trie==1.2.1
# via language-data
Expand Down
Loading