Skip to content

Commit

Permalink
fix : added task_split_type to project when task splitting complete
Browse files Browse the repository at this point in the history
  • Loading branch information
sujanadh committed Nov 20, 2023
1 parent 6fc930e commit 09feecc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/backend/app/models/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,10 @@ class BackgroundTaskStatus(IntEnum, Enum):

TILES_SOURCE = ["esri", "bing", "google", "topo"]
TILES_FORMATS = ["mbtiles", "sqlitedb", "sqlite3", "sqlite", "pmtiles"]


class TaskSplitType(StrEnum, Enum):
""" Enum describing task splitting type. """
DIVIDE_ON_SQUARE = "divide_on_square"
CHOOSE_AREA_AS_TASK = "choose_area_as_task"
TASK_SPLITTING_ALGORITHM = "task_splitting_algorithm"
2 changes: 2 additions & 0 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def create_project_with_project_info(
odk_credentials = project_metadata.odk_central
hashtags = project_metadata.hashtags
organisation_id = project_metadata.organisation_id
task_split_type = project_metadata.task_split_type

# verify data coming in
if not project_user:
Expand Down Expand Up @@ -335,6 +336,7 @@ def create_project_with_project_info(
odk_central_password=pw,
hashtags=hashtags,
organisation_id=organisation_id,
task_split_type=task_split_type,
# country=[project_metadata.country],
# location_str=f"{project_metadata.city}, {project_metadata.country}",
)
Expand Down
3 changes: 2 additions & 1 deletion src/backend/app/projects/project_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pydantic import BaseModel

from ..db import db_models
from ..models.enums import ProjectPriority, ProjectStatus
from ..models.enums import ProjectPriority, ProjectStatus, TaskSplitType
from ..tasks import tasks_schemas
from ..users.user_schemas import User

Expand Down Expand Up @@ -52,6 +52,7 @@ class BETAProjectUpload(BaseModel):
odk_central: ODKCentral
hashtags: Optional[List[str]] = None
organisation_id: Optional[int] = None
task_split_type: TaskSplitType
# city: str
# country: str

Expand Down

0 comments on commit 09feecc

Please sign in to comment.