Skip to content

Commit

Permalink
Merge branch 'release/3.12.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Nov 3, 2022
2 parents 9a24efc + 25fd1f0 commit fb1d463
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/crowdin-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
uses: actions/checkout@v3

- name: Upload or update source files to Crowdin
uses: crowdin/github-action@1.4.16
uses: crowdin/github-action@1.5.0
with:
upload_sources: true

- name: Download German translations
uses: crowdin/github-action@1.4.16
uses: crowdin/github-action@1.5.0
with:
upload_sources: false
download_translations: true
Expand All @@ -42,7 +42,7 @@ jobs:
config: crowdin.yaml

- name: Download Spanish translations
uses: crowdin/github-action@1.4.16
uses: crowdin/github-action@1.5.0
with:
upload_sources: false
download_translations: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ def load(self):
for language, content in self.content_translations.items():
if content.heading_tree:
for (i, heading_node) in enumerate(content.heading_tree):
self.chapter_section.headings.create(
self.chapter_section.headings.update_or_create(
slug=heading_node.title_slug,
name=heading_node.title,
language=language,
number=i,
defaults={
'name': heading_node.title,
'language': language,
'number': i,
}
)
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,24 @@ def load(self):
chapter_section_translations[language]["content"] = content.html_string
chapter_section_translations[language]["name"] = content.title

chapter_section = self.chapter.chapter_sections.create(
chapter_section, created = self.chapter.chapter_sections.update_or_create(
slug=section_slug,
number=section_number,
languages=list(content_translations.keys()),
defaults={
'number': section_number,
'languages': list(content_translations.keys()),
}
)

self.populate_translations(chapter_section, chapter_section_translations)
self.mark_translation_availability(chapter_section, required_fields=["name", "content"])

chapter_section.save()

self.log("Added chapter section: {}".format(chapter_section.name), 1)
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} chapter section: {chapter_section.name}', 1)

check_interactives(
content_translations[get_default_language()].required_files["interactives"],
Expand Down
18 changes: 12 additions & 6 deletions csfieldguide/chapters/management/commands/_ChaptersLoader.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,25 @@ def load(self):
if video != "" and "vimeo" not in video:
raise ValueError("Video must be a Vimeo video.")

# Create chapter object and save to the db
chapter = Chapter(
# Create or update chapter object and save to the db
chapter, created = Chapter.objects.update_or_create(
slug=self.chapter_slug,
number=self.chapter_number,
icon=chapter_icon,
video=video
defaults={
'number': self.chapter_number,
'icon': chapter_icon,
'video': video
}
)

self.populate_translations(chapter, chapter_translations)
self.mark_translation_availability(chapter, required_fields=["name", "introduction"])
chapter.save()

self.log("Added chapter: {}".format(chapter.name))
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} chapter: {chapter.name}')

check_interactives(
introduction_translations[get_default_language()].required_files["interactives"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,17 @@ def load(self):
term_translations[language]["definition"] = content.html_string
term_translations[language]["term"] = content.title

glossary_term = GlossaryTerm(
glossary_term, created = GlossaryTerm.objects.update_or_create(
slug=glossary_slug,
)
self.populate_translations(glossary_term, term_translations)
self.mark_translation_availability(glossary_term, required_fields=["term", "definition"])
glossary_term.save()

self.log("Added glossary term: {}".format(glossary_term.__str__()))
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} glossary term: {glossary_term.__str__()}')

self.log("{} glossary terms loaded!\n".format(len(glossary_slugs)))
2 changes: 1 addition & 1 deletion csfieldguide/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Module for Django system configuration."""

__version__ = "3.12.5"
__version__ = "3.12.6"
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,24 @@ def load(self):
curriculum_guide_section_translations[language]["content"] = content.html_string
curriculum_guide_section_translations[language]["name"] = content.title

curriculum_guide_section = self.curriculum_guide.curriculum_guide_sections.create(
curriculum_guide_section, created = self.curriculum_guide.curriculum_guide_sections.update_or_create(
slug=section_slug,
number=section_number,
languages=list(content_translations.keys()),
defaults={
'number': section_number,
'languages': list(content_translations.keys()),
}
)

self.populate_translations(curriculum_guide_section, curriculum_guide_section_translations)
self.mark_translation_availability(curriculum_guide_section, required_fields=["name", "content"])

curriculum_guide_section.save()

self.log("Added curriculum guide section: {}".format(curriculum_guide_section.name), 1)
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} curriculum guide section: {curriculum_guide_section.name}', 1)

check_interactives(
content_translations[get_default_language()].required_files["interactives"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,23 @@ def load(self):
curriculum_guide_translations[language]["introduction"] = content.html_string
curriculum_guide_translations[language]["name"] = content.title

# Create curriculum guide object and save to the db
curriculum_guide = CurriculumGuide(
# Create or update curriculum guide object and save to the db
curriculum_guide, created = CurriculumGuide.objects.update_or_create(
slug=self.curriculum_guide_slug,
number=self.curriculum_guide_number,
defaults={
'number': self.curriculum_guide_number,
}
)

self.populate_translations(curriculum_guide, curriculum_guide_translations)
self.mark_translation_availability(curriculum_guide, required_fields=["name", "introduction"])
curriculum_guide.save()

self.log("Added curriculum guide: {}".format(curriculum_guide.name))
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} curriculum guide: {curriculum_guide.name}')

# Load curriculum guide sections
content_path, structure_filename = os.path.split(sections)
Expand Down
1 change: 0 additions & 1 deletion csfieldguide/general/management/commands/update_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class Command(management.base.BaseCommand):

def handle(self, *args, **options):
"""Automatically called when the update_data command is given."""
management.call_command("flush", interactive=False)
management.call_command("loadappendices")
management.call_command("loadinteractives")
management.call_command("loadchapters")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ def load(self):
use_large_thumbnail = interactive_data.get("use_large_thumbnail")
if use_large_thumbnail is None:
use_large_thumbnail = False
interactive = Interactive(
interactive, created = Interactive.objects.update_or_create(
slug=interactive_slug,
is_interactive=is_interactive,
use_large_thumbnail=use_large_thumbnail,
defaults={
'is_interactive': is_interactive,
'use_large_thumbnail': use_large_thumbnail,
}
)
self.populate_translations(interactive, translations)
self.mark_translation_availability(
Expand All @@ -60,4 +62,8 @@ def load(self):
)
interactive.save()

self.log("Added interactive: {}".format(interactive.__str__()))
if created:
term = 'Created'
else:
term = 'Updated'
self.log(f'{term} interactive: {interactive.__str__()}')
13 changes: 13 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ All notable changes to this project will be documented in this file.
We have listed major changes for each release below.
`All downloads are available on GitHub <https://github.com/uccser/cs-field-guide/releases/>`__

3.12.6
==============================================================================

**Release date:** 3rd November 2022

**Changelog:**

- Update content rather than recreating it when `update_data` script is run.
- Dependency updates:

- Update crowdin/github-action from 1.4.16 to 1.5.0.
- Update sphinx-rtd-theme from 1.0.0 to 1.1.0.

3.12.5
==============================================================================

Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==5.3.0
sphinx-rtd-theme==1.0.0
sphinx-rtd-theme==1.1.0

0 comments on commit fb1d463

Please sign in to comment.