rapid-router 7.5.16__py2.py3-none-any.whl → 7.5.18__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
game/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "7.5.16"
1
+ __version__ = "7.5.18"
game/messages.py CHANGED
@@ -5,9 +5,7 @@ def video_link(url):
5
5
  return (
6
6
  "<div class='popup_video'>"
7
7
  "<video controls name='media'>"
8
- "<source src="
9
- + str(url)
10
- + "type='video/mp4'></video><br></div>"
8
+ "<source src=" + str(url) + "type='video/mp4'></video><br></div>"
11
9
  )
12
10
 
13
11
 
@@ -804,8 +802,8 @@ def description_level34():
804
802
  message = (
805
803
  "It can be handy to use <b>If</b> to give your van choices, so you don't "
806
804
  "have to give the van new instructions at every step. <br> For "
807
- "example: Tell the van <b>If</b> the <b>road exists forwards do Move "
808
- "forwards,</b> but <b>If</b> the <b>road exists left do Turn left</b>. "
805
+ "example: Tell the van <b>If</b> the <b>road exists forwards</b> do <b>Move "
806
+ "forwards</b>, <b>Else</b> do <b>Turn left</b>. "
809
807
  "<br> The van will choose correctly from the <b>Move forwards</b> and "
810
808
  "<b>Turn left</b> instructions depending on the road. <br> Use an 'if "
811
809
  "statement' in a 'loop' to drive the van down this bendy road."
@@ -816,7 +814,7 @@ def description_level34():
816
814
  def hint_level34():
817
815
  return (
818
816
  "This route looks complicated, but you can solve it without counting blocks. "
819
- "You are going to use a <b>Repeat until</b> block again and <b>If</b> blocks "
817
+ "You are going to use a <b>Repeat until</b> block again and an <b>If</b> block "
820
818
  "to help the driver check the road ahead so they can decide which way to go. "
821
819
  "What are the possible directions on this route?"
822
820
  )
@@ -850,10 +848,7 @@ def title_level36():
850
848
 
851
849
 
852
850
  def description_level36():
853
- message = video_link(
854
- "https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdCZE3FuBgH5fHsGocKGv%2Fuploads%2FsxMatN6zCvgFag8YDvK4%2FHelen%20explains%20if_else%20statements.mp4?alt=media&token=1051ab04-b02d-4b75-8278-2b63216b2985"
855
- )
856
- message += (
851
+ message = (
857
852
  f"<div class='popup_message'>"
858
853
  f"You can change the <b>if</b> block to make more choices. Click on the"
859
854
  f" {if_else_icon_url()} to add <b>else if</b>."
@@ -869,9 +864,7 @@ def description_level36():
869
864
  f"This is a general algorithm, it can be used for lots of different routes!"
870
865
  f"</div>"
871
866
  )
872
- return build_description(
873
- title_level36(), f"<div class='main_popup_container'>{message}</div>"
874
- )
867
+ return build_description(title_level36(), message)
875
868
 
876
869
 
877
870
  def hint_level36():
@@ -0,0 +1,61 @@
1
+ from django.apps.registry import Apps
2
+ from django.db import migrations
3
+
4
+ new_model_solutions_per_level = {
5
+ 34: "[6]",
6
+ 35: "[8]",
7
+ 36: "[8]",
8
+ 37: "[8]",
9
+ 40: "[6]",
10
+ 41: "[8]",
11
+ 44: "[6]",
12
+ 45: "[6]",
13
+ 46: "[8]",
14
+ 48: "[14]",
15
+ 49: "[10]",
16
+ }
17
+
18
+ old_model_solutions_per_level = {
19
+ 34: "[8,7,6]",
20
+ 35: "[11,9,8]",
21
+ 36: "[11,9,8]",
22
+ 37: "[11,9,8]",
23
+ 40: "[6,7]",
24
+ 41: "[8,9]",
25
+ 44: "[5,6]",
26
+ 45: "[6,7]",
27
+ 46: "[8,9]",
28
+ 48: "[14,15]",
29
+ 49: "[10,11,12,13,17]",
30
+ }
31
+
32
+
33
+ def update_model_solutions(apps, model_solutions_per_level):
34
+ Level = apps.get_model("game", "Level")
35
+
36
+ for level_id, model_solution in model_solutions_per_level.items():
37
+ level = Level.objects.get(pk=level_id)
38
+ level.model_solution = model_solution
39
+ level.save()
40
+
41
+
42
+ def update_solutions_to_if_else(apps: Apps, *args):
43
+ update_model_solutions(apps, new_model_solutions_per_level)
44
+
45
+
46
+ def revert_to_old_solutions(apps: Apps, *args):
47
+ update_model_solutions(apps, old_model_solutions_per_level)
48
+
49
+
50
+ class Migration(migrations.Migration):
51
+
52
+ dependencies = [
53
+ ("game", "0116_update_worksheet_video_links"),
54
+ ]
55
+
56
+ operations = [
57
+ migrations.RunPython(
58
+ code=update_solutions_to_if_else,
59
+ reverse_code=revert_to_old_solutions,
60
+ )
61
+ ]