Skip to content

Commit 71dd342

Browse files
committed
fix xMax in tutorial
1 parent 46c05e4 commit 71dd342

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

mapswipe_workers/mapswipe_workers/project_types/base/tutorial.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ def __init__(self, tutorial_draft):
2020
self.exampleImage1 = tutorial_draft.get("exampleImage1", None)
2121
self.exampleImage2 = tutorial_draft.get("exampleImage2", None)
2222
self.status = "tutorial"
23+
# need to filter out None values in list due to Firebase
24+
self.screens = list(filter(None, tutorial_draft["screens"]))
2325

2426
def save_tutorial(self):
2527
"""Save the tutorial in Firebase."""

mapswipe_workers/mapswipe_workers/project_types/tile_map_service_grid/tutorial.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from mapswipe_workers.project_types.base.tutorial import BaseTutorial
33
from mapswipe_workers.project_types.base.tile_server import BaseTileServer
44
from mapswipe_workers.utils import tile_functions as t
5+
from mapswipe_workers.definitions import ProjectType
56

67

78
class Tutorial(BaseTutorial):
@@ -15,7 +16,6 @@ def __init__(self, tutorial_draft):
1516
self.zoomLevel = int(tutorial_draft.get("zoomLevel", 18))
1617
self.tileServer = vars(BaseTileServer(tutorial_draft["tileServer"]))
1718
self.tutorial_tasks = tutorial_draft["tutorialTasks"]
18-
self.screens = tutorial_draft["screens"]
1919
self.groups = dict()
2020
self.tasks = dict()
2121

@@ -46,7 +46,7 @@ def create_tutorial_groups(self):
4646
"progress": 0, # this is not needed from back end perspective
4747
}
4848

49-
if self.projectType in [3]:
49+
if self.projectType in [ProjectType.CHANGE_DETECTION.value]:
5050
# need to adjust xMax and yMax for Change Detection projects
5151
# since they use a different view with only one tile per screen
5252
self.groups[101]["xMax"] = str(100 + (number_of_screens - 1))
@@ -111,7 +111,10 @@ def create_tutorial_tasks(self):
111111
}
112112

113113
# Completeness and Change Detection projects use a second tile image url
114-
if self.projectType in [3, 4]:
114+
if self.projectType in [
115+
ProjectType.CHANGE_DETECTION.value,
116+
ProjectType.COMPLETENESS.value,
117+
]:
115118
task["urlB"] = t.tile_coords_zoom_and_tileserver_to_url(
116119
tile_x, tile_y, self.zoomLevel, self.tileServerB
117120
)

0 commit comments

Comments
 (0)