Set spent time when using timelogs API
What does this MR do and why?
At the moment we don't set the spent_at
time when creating
timelogs via the API. This is causing issues when filtering.
This MR addresses this initially by setting it to the current time.
Moving forward, we can look to support passing a time in.
Migrations
lee@cc-gdk-2:~/gitlab-development-kit/gitlab$ bundle exec rake db:migrate:down VERSION=20211213130324 RAILS_ENV=development
== 20211213130324 UpdateTimelogsSpentAtDefault: reverting =====================
-- change_column_default(:timelogs, :spent_at, {:from=>#<Proc:0x00005563b1af2570 /home/lee/gitlab-development-kit/gitlab/db/migrate/20211213130324_update_timelogs_spent_at_default.rb:5 (lambda)>, :to=>nil})
-> 0.0042s
== 20211213130324 UpdateTimelogsSpentAtDefault: reverted (0.0059s) ============
lee@cc-gdk-2:~/gitlab-development-kit/gitlab$ bundle exec rake db:migrate:up VERSION=20211213130324 RAILS_ENV=development
== 20211213130324 UpdateTimelogsSpentAtDefault: migrating =====================
-- change_column_default(:timelogs, :spent_at, {:from=>nil, :to=>#<Proc:0x000055d799913b30 /home/lee/gitlab-development-kit/gitlab/db/migrate/20211213130324_update_timelogs_spent_at_default.rb:5 (lambda)>})
-> 0.0041s
== 20211213130324 UpdateTimelogsSpentAtDefault: migrated (0.0042s) ============
Validation steps
- Create a personal access token
- Add a timelog using the API
http://gdk.test:3000/api/v4/projects/6/issues/35/add_spent_time { "duration": 5 }
- Check the timelog record in the database has a valid
spent_at
value
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #347473 (closed)
Merge request reports
Activity
changed milestone to %14.6
added time tracking label
assigned to @leetickett
Thank you for your contribution to GitLab. We believe that everyone can contribute and contributions like yours are what make GitLab great!
- Our Merge Request Coaches will ensure your contribution is reviewed in a timely manner*.
- If you haven't, please set up a
DANGER_GITLAB_API_TOKEN
. - You can comment
@gitlab-bot label ~"group::"
to add a group label. - After a few days, feel free to ask
@gitlab-bot help
or ping a Merge Request Coach. - Read more on how to get help.
This message was generated automatically. You're welcome to improve it.
added Community contribution label
- A deleted user
added backend label
Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer backend Reuben Pereira ( @rpereira2
) (UTC+5.5)Heinrich Lee Yu ( @engwan
) (UTC+8)database Maxime Orefice ( @morefice
) (UTC+1)Tiger Watson ( @tigerwnz
) (UTC+13)~migration No reviewer available No maintainer available To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Danger- Resolved by Lee Tickett
@seanarnold could you take a glance at this please?
requested review from @seanarnold
added typebug label
Setting label(s) devopsplan groupproject management sectiondev based on groupproject management time tracking.
added devopsplan groupproject management sectiondev labels
- Resolved by Lee Tickett
- Resolved by Stan Hu