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

Fix recommended course #41646

Merged
merged 1 commit into from Jul 26, 2021
Merged

Fix recommended course #41646

merged 1 commit into from Jul 26, 2021

Conversation

daynew
Copy link
Member

@daynew daynew commented Jul 20, 2021

Our courses have been updated every year but translations aren't available for the latest year until much later. Once a course for a particular year has been fully translated into a language, we then mark the course as available in the language. To show this in the UI, we have a little Recommended tag next to the version year of the course. So you would see something like 2017 (Recommended). However, at some point front end code broke and we stopped recommending the correct year for non-English languages. This PR makes it so the correct year is recommended when a teacher is creating a new section and when a teacher browsing the course overview page.

The root cause of this bug was that the English name of a language was being used to see if it was in the list of available languages. At some point, the list of available languages started using native name for the language, rather than the English version. I could have fixed this by using the native language name instead, but I felt a better solution is to use the 4 letter locale code ??-?? (en-US, es-ES, etc) instead because it wouldn't be affected by translation changes. A lot of this PR is simply passing around the 4 letter locale codes and relying on that instead of the locale names.

Links

Testing story

  • Unit test
  • Manual tests

Screenshots

Before

Note that 2017 should be the recommended course year.
image


After

image


Before

Note that 2017 should be the recommended course year.
image


After

image


Deployment strategy

Follow-up work

Privacy

Security

Caching

PR Checklist:

  • Tests provide adequate coverage
  • Privacy and Security impacts have been assessed
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

@daynew daynew marked this pull request as ready for review July 20, 2021 20:27
@daynew daynew requested a review from a team July 20, 2021 20:27
@daynew daynew changed the title Fnd 1592 fix recommended course Fix recommended course Jul 20, 2021
Copy link
Contributor

@hacodeorg hacodeorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a lot of passing variable around. LGTM :)

For non-English teachers and students, we recommend a specific version of courses depending on how translated it is in their preferred language. This change fixes a bug where Code.org was always recommending the latest year to non-English users even if there was no translation available.
@daynew daynew force-pushed the fnd-1592-fix-recommended-course branch from c6e28dd to 86842f8 Compare July 26, 2021 21:43
@daynew daynew merged commit 14b9faa into staging Jul 26, 2021
@daynew daynew deleted the fnd-1592-fix-recommended-course branch July 26, 2021 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants