-
Notifications
You must be signed in to change notification settings - Fork 10
Metrics dash board #168
base: develop
Are you sure you want to change the base?
Metrics dash board #168
Conversation
…to HH:MM:SS conversion
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.
some comments for the backend changes for the first round. will share comments on the UI part later.
task_query = (TaskHistory.query.with_entities(TaskHistory.task_id) | ||
.filter(TaskHistory.user_id==user.id) | ||
.group_by(TaskHistory.task_id) | ||
).all() | ||
|
||
pro_query=(TaskHistory.query.with_entities(TaskHistory.project_id) | ||
.filter(TaskHistory.user_id==user.id) | ||
.group_by(TaskHistory.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.
since the same task ID may appear in multiple projects, this way of querying task IDs and project IDs separately and then iterate through all combinations seems very inefficient. Ideally this part should do one query like
SELECT DISTINCT project_id, task_id FROM task_history WHERE user_id = {user.id}
,
and then the query below should use the (project_id, task_id) tuples returned from this query to find relevant tasks and compute the "time spent on actions".
I'll let @zlavergne comment on how to do that in TM codebase.
@zlavergne :Please review