-
Notifications
You must be signed in to change notification settings - Fork 10
Adjacent lock #133
base: develop
Are you sure you want to change the base?
Adjacent lock #133
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a number of things that need to be addressed in the inline comments. Additionally, there's a couple other things:
- Let's also implement this for validation. If someone locks something for validation, we want to prevent the surrounding tasks from being locked. This shouldn't be much of a change, just using the
adjacent_task_lock/unlock
functions when we lock for validation too - Make sure to remove any unnecessary comments or console logs.
backend/models/dtos/project_dto.py
Outdated
@@ -207,7 +207,7 @@ class ProjectDTO(Model): | |||
enforce_random_task_selection = BooleanType( | |||
required=False, default=False, serialized_name="enforceRandomTaskSelection" | |||
) | |||
|
|||
adjacent_task_lock = BooleanType(required=True, default=False, serialized_name='adjacentTaskLock') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjacent_task_lock = BooleanType(required=True, default=False, serialized_name='adjacentTaskLock') | |
prevent_adjacent_task_lock = BooleanType(required=True, default=False, serialized_name='preventAdjacentTaskLock') |
Similarly to how the name "Adjacent Task Lock" is confusing, let's call it "Prevent Adjacent Task Lock" throughout the project.
backend/models/postgis/project.py
Outdated
@@ -136,6 +136,7 @@ class Project(db.Model): | |||
enforce_random_task_selection = db.Column( | |||
db.Boolean, default=False | |||
) # Force users to edit at random to avoid mapping "easy" tasks | |||
adjacent_task_lock = db.Column(db.Boolean, default=False) # Turn on adjacent lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adjacent_task_lock = db.Column(db.Boolean, default=False) # Turn on adjacent lock | |
prevent_adjacent_task_lock = db.Column(db.Boolean, default=False) # Turn on adjacent lock |
Same
backend/models/postgis/project.py
Outdated
@@ -359,6 +360,7 @@ def update(self, project_dto: ProjectDTO): | |||
self.priority = ProjectPriority[project_dto.project_priority].value | |||
self.default_locale = project_dto.default_locale | |||
self.enforce_random_task_selection = project_dto.enforce_random_task_selection | |||
self.adjacent_task_lock = project_dto.adjacent_task_lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.adjacent_task_lock = project_dto.adjacent_task_lock | |
self.prevent_adjacent_task_lock = project_dto.prevent_adjacent_task_lock |
Same
backend/models/postgis/project.py
Outdated
@@ -969,6 +971,7 @@ def _get_project_and_base_dto(self): | |||
self.validation_permission | |||
).name | |||
base_dto.enforce_random_task_selection = self.enforce_random_task_selection | |||
base_dto.adjacent_task_lock = self.adjacent_task_lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
base_dto.adjacent_task_lock = self.adjacent_task_lock | |
base_dto.prevent_adjacent_task_lock = self.prevent_adjacent_task_lock |
backend/models/postgis/project.py
Outdated
@@ -1163,6 +1166,11 @@ def get_project_campaigns(project_id: int): | |||
|
|||
return campaign_list | |||
|
|||
def get_project_adj_toggle(project_id: int): | |||
""" get the value of adjacent task lock true/false for project""" | |||
query = db.session.query(Project.adjacent_task_lock).filter(Project.id==project_id).all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
query = db.session.query(Project.adjacent_task_lock).filter(Project.id==project_id).all() | |
query = db.session.query(Project.prevent_adjacent_task_lock).filter(Project.id==project_id).all() |
Same
{ | ||
label: getLabel('ADJACENT_LOCK'), | ||
field: 'adjacentLock', | ||
backgroundColor: TASK_COLOURS.ADJACENT_LOCK, | ||
borderColor: '#929db3', | ||
}, | ||
{ | ||
label: getLabel('ADJACENTLOCK'), | ||
field: 'adjacentLock', | ||
backgroundColor: TASK_COLOURS.ADJACENTLOCK, | ||
borderColor: '#929db3', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are there two here? It looks like we only use both in different parts of the code. Let's try to remove one of them and unify the rest of the code usage.
@@ -104,6 +108,7 @@ export const TasksMap = ({ | |||
if (map.getSource('tasks') === undefined) { | |||
map.addImage('lock', lockIcon, { width: 17, height: 20, data: lockIcon }); | |||
map.addImage('redlock', redlockIcon, { width: 30, height: 30, data: redlockIcon }); | |||
// map.addImage('adjacentLock', adjLockIcon, { width: 130, height: 130, data: adjLockIcon }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove if not necessary
console.log('adjacent lock is', adjacentlocked); | ||
console.log(' lock is', locked); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove if not necessary
let taskStatusCondition = ['case']; | ||
console.log('task status ', taskStatusCondition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
frontend/src/config/index.js
Outdated
export const OSM_SERVER_URL = | ||
process.env.REACT_APP_OSM_SERVER_URL || 'https://www.openstreetmap.org'; | ||
export const ID_EDITOR_URL = | ||
process.env.REACT_APP_ID_EDITOR_URL || 'https://www.openstreetmap.org/edit?editor=id&'; | ||
export const POTLATCH2_EDITOR_URL = | ||
process.env.REACT_APP_POTLATCH2_EDITOR_URL || | ||
'https://www.openstreetmap.org/edit?editor=potlatch2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are just formatting changes, let's remove them so we avoid conflicts
Adjacent lock