Fix months dropdown for the usage quotas feature
What does this MR do and why?
Fixes missing months on the CI/CD minutes usage dropdowns
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Start a rails console session,
bundle exec rails consoleorbundle exec rails c - Create a couple of CI/CD minutes usage entries, one for December of 2022 and one for January of 2023
user = User.find(1)
project = Project.find(23) # Change this ID to whatever project ID you wish to use
monthly_usage = Ci::Minutes::ProjectMonthlyUsage.new(project_id: project.id, date: Date.new(2022, 12, 01), amount_used: 70, shared_runners_duration: 100)
monthly_usage.save
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: user.namespace.id, date: Date.new(2022, 12, 01), amount_used: 70, shared_runners_duration: 100)
namespace_usage.save
monthly_usage = Ci::Minutes::ProjectMonthlyUsage.new(project_id: project.id, date: Date.new(2023, 01, 01), amount_used: 120, shared_runners_duration: 150)
monthly_usage.save
namespace_usage = Ci::Minutes::NamespaceMonthlyUsage.new(namespace_id: user.namespace.id, date: Date.new(2023, 01, 01), amount_used: 120, shared_runners_duration: 150)
namespace_usage.save
- Go to User preferences -> Usage Quotas and play with the
Usage by Projectdropdowns and they should display accordingly
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.
Edited by Jose Ivan Vargas

