kapt-labs/bugboard

Tasks are not properly updated

Closed this issue · 3 comments

After a db reset I noticed that the tasks are not updated when using manage.py updatebbdb --all or manage.py updatebbdb -t (update stored tasks; get admin link, get priority).
The problem is this condition:

if (
pytz.UTC.fromutc(
(
datetime.datetime.strptime(
t["updated_at"], "%Y-%m-%dT%H:%M:%S.%fZ"
)
)
)
> task.updated_at

admin_link & priority are updated (even for the first time) only if the distant task was updated since it was downloaded.

Reopening this issue because these two lines are not updated when a task already exist in the db:

self.task_tag_list.append([t["id"], t["tag_names"]])
self.task_assignee_list.append([t["id"], t["assignee_ids"]])

The problem is that when using api_v2/projects/X/tasks/, we have an assignee_ids list, but when using api_v2/projects/X/tasks/Y.json, we only have an assignees dict, which is in fact a Member object.
So when updating tasks from local db list, we have to loop through the assignees dict to gather all ids, then append them to self.task_assignees_list.

The problem with assignee is not solved, because we fill self.task_assignees_list but we do not synchronize it with the db.