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

🪲 Check for programs with empty string as adventure id #5208

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

jpelay
Copy link
Member

@jpelay jpelay commented Mar 4, 2024

Some old programs present the challenge of having an empty string in their adventure_name field. Luckily, this doesn't seem to happen anymore, as I checked the DB and in production only programs from around 2022 present this issue.

How to test

  • Copy and paste an existing program in the DB, change the id and put an emtpy string in the adventure_name field. On main, it should crash, using this branch, the programs page should be shown normally.

Here's an example for the user student1:

    {
      "session": "fac24066d19f4fd8ac44508ac4a7fdae",
      "date": 1709241804445,
      "lang": "en",
      "version": "DEV",
      "level": 1,
      "code": "ask What's your name?\necho so your name is\nask What's your name?\necho so your name isask What's your name?\necho so your name isask What's your name?\necho so your name isask What's your name?\necho so your name isask What's your name?\necho so your name is",
      "name": "adventure1 test test",
      "username": "student1",
      "adventure_name": "",
      "id": "ididididididididididi",
      "username_level": "student1-1",
      "public_profile": null
    }

@jpelay jpelay requested a review from Felienne March 4, 2024 15:13
app.py Outdated
for program in all_programs:
if 'adventure_name' in program and program['adventure_name'] not in adventure_names:
if 'adventure_name' in program and program['adventure_name'] != '' and\
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if 'adventure_name' in program and program['adventure_name'] != '' and\
if 'adventure_name' in program and program['adventure_name'] and\

I think this formulation is slightly more Pythonic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

mergify bot commented Mar 5, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit d646440 into main Mar 5, 2024
11 checks passed
@mergify mergify bot deleted the fix_programs_page_3 branch March 5, 2024 15:57
Copy link
Contributor

mergify bot commented Mar 5, 2024

Thank you for contributing! Your pull request is now going on the merge train (choo choo! Do not click update from main anymore, and be sure to allow changes to be pushed to your fork).

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.

2 participants