Skip to content

Commit

Permalink
Merge pull request #543 from mapswipe/limit-tasks-per-user
Browse files Browse the repository at this point in the history
allow to set maxTasksPerUser for all project
  • Loading branch information
Hagellach37 committed Jun 9, 2022
2 parents fd15341 + 20968a2 commit 9bc6d02
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
8 changes: 4 additions & 4 deletions manager_dashboard/manager_dashboard/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function displayProjectTypeForm(projectType) {
document.getElementById("form_tile_server_a").style.display = "block";
document.getElementById("form_tile_server_b").style.display = "None";
setTimeout(function(){ ProjectAoiMap.invalidateSize()}, 400);
document.getElementById("form_team_settings").style.display = "None";
document.getElementById("form_team_settings").style.display = "block";
break;
case "footprint":
initTutorials(FOOTPRINT_TYPE);
Expand All @@ -93,7 +93,7 @@ function displayProjectTypeForm(projectType) {
document.getElementById("form_zoom_level").style.display = "None";
document.getElementById("form_tile_server_a").style.display = "block";
document.getElementById("form_tile_server_b").style.display = "None";
document.getElementById("form_team_settings").style.display = "None";
document.getElementById("form_team_settings").style.display = "block";
break;
case "change_detection":
case "completeness":
Expand All @@ -112,7 +112,7 @@ function displayProjectTypeForm(projectType) {
document.getElementById("form_tile_server_a").style.display = "block";
document.getElementById("form_tile_server_b").style.display = "block";
setTimeout(function(){ ProjectAoiMap.invalidateSize()}, 400);
document.getElementById("form_team_settings").style.display = "None";
document.getElementById("form_team_settings").style.display = "block";
break;
}
}
Expand All @@ -135,7 +135,7 @@ function addTileServerCredits (tileServerName, which) {
function displayTeamSettings (teamId) {
switch (teamId) {
case "public":
document.getElementById("form_team_settings").style.display = "None";
document.getElementById("form_team_settings").style.display = "block";
break;
default:
document.getElementById("form_team_settings").style.display = "block";
Expand Down
12 changes: 7 additions & 5 deletions manager_dashboard/manager_dashboard/js/uploadProjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ function getFormInput() {
' (' + form_data.projectNumber + ')\n' +
form_data.requestingOrganisation

// add teamId if visibility is not set to public
// add limit how many tasks a user can work on
maxTasksPerUser = document.getElementById("maxTasksPerUser").value
if (maxTasksPerUser > 0) {
form_data.maxTasksPerUser = maxTasksPerUser
}

visibility = document.getElementById("visibility").value
// add teamId if visibility is not set to public
if (visibility !== "public") {
form_data.teamId = visibility
maxTasksPerUser = document.getElementById("maxTasksPerUser").value
if (maxTasksPerUser > 0) {
form_data.maxTasksPerUser = maxTasksPerUser
}
}

// add project type specific attributes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ def __init__(self, project_draft):
self.resultCount = 0
self.teamId = project_draft.get("teamId", None)
self.verificationNumber = project_draft["verificationNumber"]
max_tasks_per_user = project_draft.get("maxTasksPerUser", None)
if max_tasks_per_user is not None:
self.maxTasksPerUser = int(max_tasks_per_user)

if not self.teamId:
self.status = "inactive" # this is a public project
else:
self.status = (
"private_inactive" # private project visible only for team members
)
max_tasks_per_user = project_draft.get("maxTasksPerUser", None)
if max_tasks_per_user is not None:
self.maxTasksPerUser = int(max_tasks_per_user)

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

Expand Down

0 comments on commit 9bc6d02

Please sign in to comment.