Skip to content

Introduce Start, Current, and end Values

Abhilash Kotte requested to merge be_start_and_end_values_widget into master

What does this MR do and why?

This MR add start, end, and current columns to progress table. gitlab-org/incubation-engineering/okr/meta#29 (closed)

  1. Adds Start, End, and Current value columns for work_item_progresses table.
  2. Post-deployment migration to backfill current_value with progress
  3. Update current_value whenever progress is updated.

There will be followup MRs and full context can be found in this EPIC - &8991

In the immediate followup MR,

  1. Write to current_value instead of progress column
  2. Calculate progress value from start, end, and current value
  3. Make progress read-only.

Migration Output

bundle exec rake db:migrate


main: == 20230313092109 AddStartEndAndCurrentValuesToWiProgressess: migrating =======
main: -- add_column(:work_item_progresses, :start_value, :float, {:default=>0, :null=>false})
main:    -> 0.0023s
main: -- add_column(:work_item_progresses, :end_value, :float, {:default=>100, :null=>false})
main:    -> 0.0005s
main: -- add_column(:work_item_progresses, :current_value, :float, {:default=>0, :null=>false})
main:    -> 0.0004s
main: == 20230313092109 AddStartEndAndCurrentValuesToWiProgressess: migrated (0.0072s)

main: == 20230316073726 BackfillCurrentValueWithProgressWorkItemProgresses: migrating
main: == 20230316073726 BackfillCurrentValueWithProgressWorkItemProgresses: migrated (0.0157s)

How to set up and validate locally

  1. Run bundle exec rails db:migrate
  2. Enable okrs_mvc feature flag for a project Feature.enable(:okrs_mvc, Project.find(6)
  3. Create an Objective from Issues List(Use New Issue dropdown) and create couple of children and enter progress value
  4. From rails console fetch the progress record for the work item WorkItem.find(:id).progress and progress and current_value should be same as the one entered in above step
  5. Run rake task bundle exec rake gitlab:work_items:copy_wi_progress

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Abhilash Kotte

Merge request reports

Loading