Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timetracking Overview Improvements #7789

Merged
merged 10 commits into from
May 13, 2024
Merged

Conversation

fm3
Copy link
Member

@fm3 fm3 commented May 7, 2024

Contributes to #7788 by fixing

  • left-aligned annotation stats in table
  • faster sql query for time summed by annotation (on a production database with 6M annotations: before: 7000ms, after: 100ms)
  • prepares backend to filter by annotation state
  • search in dropdown by typing project name instead of id

Not included for now:

  • frontend for filtering by annotation state
  • include annotation state in csv and displayed table

URL of deployed dev instance (used for testing):

Steps to test:

  • Annotate some, open timetracking page, expand user entries, should be fast, look pretty even for annotations with many trees.

Issues:


  • Updated changelog
    webknossos/webknossos/client) if relevant API parts change
  • Removed dev-only changes like prints and application.conf edits
  • Considered common edge cases

@fm3 fm3 self-assigned this May 7, 2024
@fm3 fm3 changed the title WIP: in time tracking, filter by annotation state Timetracking Overview Improvements May 8, 2024
@fm3 fm3 marked this pull request as ready for review May 8, 2024 09:50
@@ -2016,6 +2016,7 @@ export async function getTimeTrackingForUserSummedPerAnnotation(
if (annotationTypes != null) params.append("annotationTypes", annotationTypes);
if (projectIds != null && projectIds.length > 0)
params.append("projectIds", projectIds.join(","));
params.append("annotationStates", "Active,Finished");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a prerequisite to show the annotations state in the table and in the CSV, and to filter it, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, only for the filtering at this time. I wrote this before I learned that the priority is lower for now. I guess we can use it in the frontend in a later iteration, or remove it again if we decide we don’t want to go for this option :)

Copy link
Contributor

@dieknolle3333 dieknolle3333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took a look at the frontend code and tested the code and I think both looks good :) thank you!

Copy link
Contributor

@MichaelBuessemeyer MichaelBuessemeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The backend code also looks good to me 👍

@fm3, did you take measurements on the speed up of the summedByAnnotationForUser query? If you still have them, could you please add them to the PR for documentation purposes? 🙏

Please note that I did not do any testing and only looked at the code as @dieknolle3333 already tested the changes :)

Comment on lines 253 to 255
GET /time/user/:userId/spans controllers.TimeController.timeSpansOfUser(userId: String, start: Long, end: Long, annotationTypes: String, projectIds: Option[String])
GET /time/user/:userId/summedByAnnotation controllers.TimeController.timeSummedByAnnotationForUser(userId: String, start: Long, end: Long, annotationTypes: String, projectIds: Option[String])
GET /time/overview controllers.TimeController.timeOverview(start: Long, end: Long, annotationTypes: String, teamIds: Option[String], projectIds: Option[String])
GET /time/user/:userId/spans controllers.TimeController.timeSpansOfUser(userId: String, start: Long, end: Long, annotationTypes: String, projectIds: Option[String], annotationStates: String)
GET /time/user/:userId/summedByAnnotation controllers.TimeController.timeSummedByAnnotationForUser(userId: String, start: Long, end: Long, annotationTypes: String, projectIds: Option[String], annotationStates: String)
GET /time/overview controllers.TimeController.timeOverview(start: Long, end: Long, annotationTypes: String, teamIds: Option[String], projectIds: Option[String], annotationStates: String)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the order of parameters here important? One common rule is that Optional Parameters should be last in param order. Does this apply here as well (at least as a style)? I guess play forwards the projectIds as Some(null) automatically in case the param is absent. Thus, the order is likely irrelevant.

But looking at the file, in most cases the option types are last in order.

But as this is likely not a syntax error / error in the code, also feel free to ignore this comment :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the order isn’t relevant here for the compiler, as this is, so to speak, always called by name. If an optional parameter is omitted from a request query, it is auto-filled with None (different from Some(null). In fact we want to avoid null wherever possible, since the type-checker does not deal with it).

However, you are right; at least for style, I’ll move the new parameter so that the optional ones stay last.

@fm3 fm3 merged commit ab45941 into master May 13, 2024
2 checks passed
@fm3 fm3 deleted the timetracking-filter-by-annotation-state branch May 13, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants