Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
boryanagoncharenko authored Feb 4, 2025
2 parents 23362e4 + 3f2c029 commit 297d19b
Show file tree
Hide file tree
Showing 56 changed files with 2,489 additions and 182 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Restrict who can run this workflow
- if: github.actor != 'Felienne' && github.actor != 'jpelay'
- if: github.actor != 'Felienne' && github.actor != 'jpelay' && github.actor != 'boryanagoncharenko'
run: |
echo "You must be Felienne to run this workflow :D" >&2
exit 1
Expand Down
8 changes: 7 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1452,12 +1452,14 @@ def index(level, program_id):
return utils.error_page(error=404, ui_message=gettext('no_such_level'))

loaded_program = None
suppress_save_and_load = False
if program_id:
result = g_db().program_by_id(program_id)
if not result or not get_current_user_program_permissions(result):
return utils.error_page(error=404, ui_message=gettext('no_such_program'))

loaded_program = Program.from_database_row(result)
suppress_save_and_load = True

# Initially all levels are available -> strip those for which conditions
# are not met or not available yet
Expand Down Expand Up @@ -1668,6 +1670,7 @@ def index(level, program_id):
adventures=adventures,
initial_tab=initial_tab,
current_user_name=current_user()['username'],
suppress_save_and_load=suppress_save_and_load,
))


Expand All @@ -1683,12 +1686,14 @@ def tryit(level, program_id):
return utils.error_page(error=404, ui_message=gettext('no_such_level'))

loaded_program = None
suppress_save_and_load = False
if program_id:
result = g_db().program_by_id(program_id)
if not result or not get_current_user_program_permissions(result):
return utils.error_page(error=404, ui_message=gettext('no_such_program'))

loaded_program = Program.from_database_row(result)
suppress_save_and_load = True

# Initially all levels are available -> strip those for which conditions
# are not met or not available yet
Expand Down Expand Up @@ -1899,6 +1904,7 @@ def tryit(level, program_id):
adventures=adventures,
initial_tab=initial_tab,
current_user_name=current_user()['username'],
suppress_save_and_load=suppress_save_and_load,
))


Expand Down Expand Up @@ -2069,7 +2075,7 @@ def render_code_in_editor(level):
adventures=adventures,
initial_tab='start',
current_user_name=current_user()['username'],
suppress_save_and_load_for_slides=True,
suppress_save_and_load=True,
))


Expand Down
2 changes: 1 addition & 1 deletion content/adventures/ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ adventures:
{print} "أنت أكبر مني!"
```
15:
story_text: "سنتعلم نوعا جديداً من دورات التكرار، التكرار باستخدام الأمر `{while}`! يستمر تنفيذ الكود طالما لا تزال نتيجة الفحص الذي نقوم به صالحة/صحيحة. \n لذلك يجب علينا ألا ننسى أن نغير قيمة المتغير الذي نفحصه في داخل دورة التكرار. \n\nفي المثال التوضيحي، يستمر الكود في التنفيذ (سؤال نتيجة الضرب) حتى نحصل على اجابة صحيحة.\nاذا لم يتم اعطاء اجابة صحيحة فتستمر دورة التكرار (والبرنامج ككل) في التتنفيذ الى الأبد!"
story_text: "سنتعلم نوعا جديداً من دورات التكرار، التكرار باستخدام الأمر `{while}`! يستمر تنفيذ الكود طالما لا تزال نتيجة الفحص الذي نقوم به صالحة/صحيحة. \n لذلك يجب علينا ألا ننسى أن نغير قيمة المتغير الذي نفحصه في داخل دورة التكرار. \n\nفي المثال التوضيحي، يستمر الكود في التنفيذ (سؤال نتيجة الضرب) حتى نحصل على اجابة صحيحة.\nاذا لم يتم اعطاء اجابة صحيحة فتستمر دورة التكرار (والبرنامج ككل) في التتنفيذ الى الأبد!\n"
example_code: "```\nالاجابة = ٠ \n{while} الاجابة != ٢٥\n الاجابة = {ask} \"ما ناتج ٥ ضرب ٥؟\"\n{print} \"تم الاجابة بشكل صحيح\"\n```\n"
16:
story_text: "سنتعلم الان كيفية كتابة القائمة باستخدام طريقة لغة البرمجة بايثون (python) عن طريق احاطة القائمة بالأقواس المربعة (أو المعقوفتان)! نستمر بوضع علامات الاقتباس حول كل عنصر نصي (كلمة اواسم مثلا) كما في المستويات السابقة. \nيمكننا استخدام الأقواس المربعة أيضا للاشارة الى مكان محدد في القائمة."
Expand Down
2 changes: 1 addition & 1 deletion content/adventures/ca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1968,7 +1968,7 @@ adventures:
story_text: "En aquest nivell aprendràs com demanar fàcilment comandes per a diferents plats.\n\n### Exercici 1\nAcaba el codi amb una comanda `{ask}` en els buits de manera que se li pregunti al client què vol menjar per a cada plat.\n"
example_code: "```\nplats = entrant, primer plat, postres\n{for} plat {in} plats\n {print} \"Què vol de \" plat \"?\"\n _ \n _\n```\n"
story_text_2: "### Exercici\nPer descomptat, també pots fer una comanda per a diverses persones!\nPots afegir la quantitat correcta d'indentació abans de cada línia perquè el codi funcioni correctament?\nConsell: algunes línies no necessiten cap indentació.\n"
example_code_2: "```\n_ plats = primer plat, segon plat, postre\n_ noms= Toni, Olga\n_ {for} nom {in} noms\n_ {for} plat {in} plats\n_ menjar = {ask} nom ', què t'agradaria menjar com a ' course '?'\n_ {print} nom' demana ' menjar ' com a ' plat\n```\n"
example_code_2: "```\n_ plats = primer plat, segon plat, postre\n_ noms= Toni, Olga\n_ {for} nom {in} noms\n_ {for} plat {in} plats\n_ menjar = {ask} nom \", què t'agradaria menjar com a \" plat \"?\"\n_ {print} nom \" demana \" menjar \" com a \" plat\n```\n"
8:
story_text: "En aquest nivell pots fer que el teu restaurant virtual sigui més elaborat repetint diverses línies de codi. Com això:\n\n### Exercici\nAquest codi es pot ampliar amb més elements al menú, per exemple oferint begudes i/o diversos plats o postres. Afegeix almenys un element més.\n**Extra** Afegeix encara més elements, tantes opcions com vulguis!\n"
example_code: "```\n{print} \"Benvinguts al restaurant del Chef Hedy\"\ngent = {ask} \"Quantes persones sereu a taula?\"\n{print} \"Perfecte!\"\n{repeat} gent {times}\n menjar = {ask} \"Què voldrà menjar?\"\n {print} menjar\n{print} \"Moltes gràcies per la comanda!\"\n{print} \"Bon profit!\"\n```\n"
Expand Down
Loading

0 comments on commit 297d19b

Please sign in to comment.