Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
dchhabda committed Jan 24, 2023
1 parent e0f3382 commit d5aa791
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pybossa/api/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def _forbidden_attributes(self, data):

def _update_attribute(self, new, old):
for key, value in old.info.items():
if not new.info.get(key):
new.info[key] = value
new.info.setdefault(key, value)

gold_task = bool(new.gold_answers)
n_taskruns = len(new.task_runs)
Expand Down
3 changes: 1 addition & 2 deletions pybossa/api/task_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ def _update_object(self, taskrun):

def _update_attribute(self, new, old):
for key, value in old.info.items():
if not new.info.get(key):
new.info[key] = value
new.info.setdefault(key, value)

def _forbidden_attributes(self, data):
for key in data.keys():
Expand Down
1 change: 0 additions & 1 deletion pybossa/auth/taskrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def _update(self, user, taskrun):
project = self.project_repo.get(taskrun.project_id)
allow_taskrun_edit = project.info.get("allow_taskrun_edit") or False
return user.admin or (allow_taskrun_edit and taskrun.user_id == user.id)
return user.admin or taskrun.user_id == user.id


def _delete(self, user, taskrun):
Expand Down

0 comments on commit d5aa791

Please sign in to comment.