Skip to content

Commit 38541e0

Browse files
committed
refactor: cleanup confusing unused code, swap frontend map legend order
1 parent 6229619 commit 38541e0

File tree

3 files changed

+33
-86
lines changed

3 files changed

+33
-86
lines changed

src/backend/app/db/db_models.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from sqlalchemy.dialects.postgresql import JSONB, UUID
2222
from sqlalchemy.orm import (
2323
declarative_base,
24-
object_session,
2524
relationship,
2625
)
2726

@@ -35,7 +34,6 @@
3534
RegulatorApprovalStatus,
3635
State,
3736
TaskSplitType,
38-
TaskStatus,
3937
UserRole,
4038
)
4139
from app.utils import timestamp
@@ -127,7 +125,6 @@ class DbProject(Base):
127125
side_overlap = cast(float, Column(Float, nullable=True))
128126
gsd_cm_px = cast(float, Column(Float, nullable=True)) # in cm_px
129127
altitude_from_ground = cast(float, Column(Float, nullable=True))
130-
gsd_cm_px = cast(float, Column(Float, nullable=True))
131128
camera_bearings = cast(list[int], Column(ARRAY(SmallInteger), nullable=True))
132129
gimble_angles_degrees = cast(list, Column(ARRAY(SmallInteger), nullable=True))
133130
is_terrain_follow = cast(bool, Column(Boolean, default=False))
@@ -201,39 +198,6 @@ class DbProject(Base):
201198
{},
202199
)
203200

204-
@property
205-
def tasks_mapped(self):
206-
"""Get the number of tasks mapped for a project."""
207-
return (
208-
object_session(self)
209-
.query(DbTask)
210-
.filter(DbTask.task_status == TaskStatus.MAPPED)
211-
.with_parent(self)
212-
.count()
213-
)
214-
215-
@property
216-
def tasks_validated(self):
217-
"""Get the number of tasks validated for a project."""
218-
return (
219-
object_session(self)
220-
.query(DbTask)
221-
.filter(DbTask.task_status == TaskStatus.VALIDATED)
222-
.with_parent(self)
223-
.count()
224-
)
225-
226-
@property
227-
def tasks_bad(self):
228-
"""Get the number of tasks marked bad for a project."""
229-
return (
230-
object_session(self)
231-
.query(DbTask)
232-
.filter(DbTask.task_status == TaskStatus.BAD)
233-
.with_parent(self)
234-
.count()
235-
)
236-
237201

238202
class DbProjectImage(Base):
239203
"""Describes an uploaded image for a project."""

src/backend/app/models/enums.py

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,6 @@ class FinalOutput(StrEnum):
2222
DIGITAL_SURFACE_MODEL = "DIGITAL_SURFACE_MODEL"
2323

2424

25-
class TaskStatus(IntEnum):
26-
"""Enum describing available Task Statuses."""
27-
28-
READY = 0
29-
LOCKED_FOR_MAPPING = 1
30-
MAPPED = 2
31-
LOCKED_FOR_VALIDATION = 3
32-
VALIDATED = 4
33-
INVALIDATED = 5
34-
BAD = 6 # Task cannot be mapped
35-
SPLIT = 7 # Task has been split
36-
37-
38-
class TaskAction(IntEnum):
39-
"""All possible task actions, recorded in task history."""
40-
41-
RELEASED_FOR_MAPPING = 0
42-
LOCKED_FOR_MAPPING = 1
43-
MARKED_MAPPED = 2
44-
LOCKED_FOR_VALIDATION = 3
45-
VALIDATED = 4
46-
MARKED_INVALID = 5
47-
MARKED_BAD = 6 # Task cannot be mapped
48-
SPLIT_NEEDED = 7 # Task needs split
49-
RECREATED = 8
50-
COMMENT = 9
51-
52-
5325
class TaskSplitType(IntEnum):
5426
"""Enum describing task splitting type."""
5527

@@ -139,17 +111,21 @@ class UserRole(IntEnum):
139111
class State(IntEnum):
140112
"""The state of a task.
141113
114+
This is determined from the most recent entry in `task_events`
115+
for a given task.
116+
142117
The state can be:
143-
- ``request for mapping``
144-
- ``unlocked to map``
145-
- ``locked for mapping``
146-
- ``unlocked to validate``
147-
- ``locked for validation``
148-
- ``unlocked done``
149-
- ``Unflyable task``
150-
- ``image uploaded``
151-
- ``image processed``
152-
- ``image processing failed``
118+
- REQUEST_FOR_MAPPING: someone was request to map the task.
119+
- UNLOCKED_TO_MAP: default status, ready to fly.
120+
- LOCKED_FOR_MAPPING: locked by a user that is about to fly the task.
121+
- ~UNLOCKED_TO_VALIDATE~: flying complete, requires validation (not used yet).
122+
- ~LOCKED_FOR_VALIDATION~: currently being validated (not used yet).
123+
- ~UNLOCKED_DONE~: task is complete and validated (currently not used).
124+
- UNFLYABLE_TASK: not possibly to fly - marked bad.
125+
- IMAGE_UPLOADED: imagery has been uploaded for the task.
126+
- IMAGE_PROCESSING_FAILED: failed processing in ODM.
127+
- IMAGE_PROCESSING_STARTED: started processing in ODM.
128+
- IMAGE_PROCESSING_FINISHED: successful processing in ODM.
153129
"""
154130

155131
REQUEST_FOR_MAPPING = -1

src/frontend/src/components/IndividualProject/MapSection/Legend.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,35 +20,42 @@ const Legend = () => {
2020
</div>
2121
{showLegendItems && (
2222
<div className="naxatw-flex naxatw-flex-col naxatw-gap-1">
23+
{/* REQUEST_FOR_MAPPING */}
2324
<div className="naxatw-flex naxatw-gap-2">
24-
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#ACD2C4]" />
25-
<p className="naxatw-text-sm">Finished Tasks</p>
25+
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#F3C5C5]" />
26+
<p className="naxatw-text-sm">Flight Requested</p>
27+
</div>
28+
{/* LOCKED_FOR_MAPPING */}
29+
<div className="naxatw-flex naxatw-gap-2">
30+
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#98BBC8]">
31+
<img src={lock} alt="area-icon" className="naxatw-p-0.5" />
32+
</div>
33+
<p className="naxatw-text-sm">Locked Tasks</p>
2634
</div>
35+
{/* IMAGE_UPLOADED */}
2736
<div className="naxatw-flex naxatw-gap-2">
2837
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#9ec7ff]" />
29-
<p className="naxatw-text-sm">Image Uploaded</p>
38+
<p className="naxatw-text-sm">Ready To Process</p>
3039
</div>
40+
{/* IMAGE_PROCESSING_STARTED */}
3141
<div className="naxatw-flex naxatw-gap-2">
3242
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#9C77B2] naxatw-opacity-60" />
3343
<p className="naxatw-text-sm">Image Processing Started</p>
3444
</div>
45+
{/* IMAGE_PROCESSING_FAILED */}
3546
<div className="naxatw-flex naxatw-gap-2">
3647
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#D73F3F] naxatw-opacity-60" />
3748
<p className="naxatw-text-sm">Image Processing Failed</p>
3849
</div>
50+
{/* IMAGE_PROCESSING_FINISHED */}
3951
<div className="naxatw-flex naxatw-gap-2">
40-
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#F3C5C5]" />
41-
<p className="naxatw-text-sm">Requested Tasks</p>
42-
</div>
43-
<div className="naxatw-flex naxatw-gap-2">
44-
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#98BBC8]">
45-
<img src={lock} alt="area-icon" className="naxatw-p-0.5" />
46-
</div>
47-
<p className="naxatw-text-sm">Locked Tasks</p>
52+
<div className="naxatw-h-5 naxatw-w-5 naxatw-bg-[#ACD2C4]" />
53+
<p className="naxatw-text-sm">Finished Tasks</p>
4854
</div>
55+
{/* UNLOCKED_TO_MAP */}
4956
<div className="naxatw-flex naxatw-gap-2">
5057
<div className="naxatw-h-5 naxatw-w-5 naxatw-border naxatw-border-[#68707F]" />
51-
<p className="naxatw-text-sm">Remaining Task</p>
58+
<p className="naxatw-text-sm">Not Started</p>
5259
</div>
5360
<div className="naxatw-flex naxatw-gap-2">
5461
<div className="naxatw-h-5 naxatw-w-5">

0 commit comments

Comments
 (0)