Skip to content

Commit 4869863

Browse files
committed
work on comments
1 parent 71ce357 commit 4869863

File tree

7 files changed

+29
-16
lines changed

7 files changed

+29
-16
lines changed

firebase/database.rules.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
||
1616
(auth != null && query.orderByChild == 'status' && query.equalTo == 'build_area_tutorial' && query.limitToFirst == 1)
1717
||
18-
(auth != null && query.orderByChild == 'name' && query.equalTo == 'build_area_tutorial_solid_waste' && query.limitToFirst == 1)
19-
||
2018
// only team members can query by their own teamId
2119
(auth != null && query.orderByChild == 'teamId' &&
2220
query.equalTo == root.child('/v2/users/'+auth.uid+'/teamId').val())

manager_dashboard/manager_dashboard/js/forms.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
const BUILD_AREA_TYPE = 1
2+
const FOOTPRINT_TYPE = 2
3+
const CHANGE_DETECTION_TYPE = 3
4+
const COMPLETENESS_TYPE = 4
5+
16
//auto expand textarea
27
function adjust_textarea(h) {
38
h.style.height = "20px";
@@ -68,7 +73,7 @@ function displayProjectTypeForm(projectType) {
6873
document.getElementById("projectType").value = projectType;
6974
switch (projectType) {
7075
case "build_area":
71-
initTutorials(1);
76+
initTutorials(BUILD_AREA_TYPE);
7277
displayTileServer("bing", "A");
7378
document.getElementById("groupSize").value = 120;
7479
document.getElementById("form_project_aoi_geometry").style.display = "block";
@@ -80,7 +85,7 @@ function displayProjectTypeForm(projectType) {
8085
document.getElementById("form_team_settings").style.display = "None";
8186
break;
8287
case "footprint":
83-
initTutorials(2);
88+
initTutorials(FOOTPRINT_TYPE);
8489
displayTileServer("bing", "A");
8590
document.getElementById("groupSize").value = 25;
8691
document.getElementById("form_project_aoi_geometry").style.display = "None";
@@ -96,10 +101,10 @@ function displayProjectTypeForm(projectType) {
96101
displayTileServer("bing", "B");
97102
if (projectType == "change_detection") {
98103
document.getElementById("groupSize").value = 25;
99-
initTutorials(3);
104+
initTutorials(CHANGE_DETECTION_TYPE);
100105
} else {
101106
document.getElementById("groupSize").value = 80;
102-
initTutorials(4);
107+
initTutorials(COMPLETENESS_TYPE);
103108
}
104109
document.getElementById("form_project_aoi_geometry").style.display = "block";
105110
document.getElementById("form_project_task_geometry").style.display = "None";

manager_dashboard/manager_dashboard/js/uploadProjects.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function getFormInput() {
2222

2323
// add teamId if visibility is not set to public
2424
visibility = document.getElementById("visibility").value
25-
if (visibility != "public") {
25+
if (visibility !== "public") {
2626
form_data.teamId = visibility
2727
maxTasksPerUser = document.getElementById("maxTasksPerUser").value
2828
if (maxTasksPerUser > 0) {

mapswipe_workers/mapswipe_workers/project_types/base/project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self, project_draft):
7878
"private_inactive" # private project visible only for team members
7979
)
8080
max_tasks_per_user = project_draft.get("maxTasksPerUser", None)
81-
if max_tasks_per_user:
81+
if max_tasks_per_user is not None:
8282
self.maxTasksPerUser = int(max_tasks_per_user)
8383

8484
self.tutorialId = project_draft.get("tutorialId", None)

mapswipe_workers/mapswipe_workers/project_types/tile_map_service_grid/project.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
CustomError,
88
logger,
99
MAX_INPUT_GEOMETRIES,
10+
ProjectType,
1011
)
1112
from mapswipe_workers.project_types.tile_map_service_grid.group import Group
1213
from mapswipe_workers.utils import tile_grouping_functions as grouping_functions
@@ -24,7 +25,10 @@ def __init__(self, project_draft: dict):
2425
self.tileServer = vars(BaseTileServer(project_draft["tileServer"]))
2526

2627
# get TileServerB for change detection and completeness type
27-
if self.projectType in [3, 4]:
28+
if self.projectType in [
29+
ProjectType.COMPLETENESS.value,
30+
ProjectType.CHANGE_DETECTION.value,
31+
]:
2832
self.tileServerB = vars(BaseTileServer(project_draft["tileServerB"]))
2933

3034
def validate_geometries(self):

mapswipe_workers/mapswipe_workers/project_types/tile_map_service_grid/task.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from mapswipe_workers.project_types.base.task import BaseTask
22
from mapswipe_workers.utils import tile_functions as t
3+
from mapswipe_workers.definitions import ProjectType
34

45

56
class Task(BaseTask):
@@ -42,7 +43,10 @@ def __init__(self, group: object, project: object, TileX: str, TileY: str):
4243
)
4344

4445
# get TileServer B only for change_detection or completeness type
45-
if project.projectType in [3, 4]:
46+
if project.projectType in [
47+
ProjectType.COMPLETENESS.value,
48+
ProjectType.CHANGE_DETECTION.value,
49+
]:
4650
self.urlB = t.tile_coords_zoom_and_tileserver_to_url(
4751
TileX, TileY, project.zoomLevel, project.tileServerB
4852
)

mapswipe_workers/python_scripts/add_tutorial_id_to_projects.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import sys
22
from mapswipe_workers.auth import firebaseDB
3-
from mapswipe_workers.definitions import logger
3+
from mapswipe_workers.definitions import logger, ProjectType
44

55

6-
def get_all_projects(project_type: int):
7-
"""Get the user ids from all users in Firebase DB."""
6+
def get_all_projects_of_type(project_type: int):
7+
"""Get the project ids for active and inactive projects in Firebase DB."""
88

99
project_id_list = []
1010
fb_db = firebaseDB()
1111

12+
# we neglect private projects here
13+
# since there are no projects set up in production yet
1214
status_list = ["active", "inactive"]
1315

1416
for status in status_list:
@@ -37,8 +39,8 @@ def add_tutorial_id_to_projects(project_id_list, tutorial_id):
3739

3840

3941
if __name__ == "__main__":
40-
"""python add_tutorial_id_to_projects.py project_type tutorial_id"""
41-
project_type = sys.argv[1]
42+
"""python add_tutorial_id_to_projects.py BUILD_AREA tutorial_id"""
43+
project_type = ProjectType[sys.argv[1]].value
4244
tutorial_id = sys.argv[2]
43-
project_id_list = get_all_projects(1)
45+
project_id_list = get_all_projects_of_type(project_type)
4446
add_tutorial_id_to_projects(project_id_list, tutorial_id)

0 commit comments

Comments
 (0)