Fix default calculation method for new decaying average

When the new decaying average FF and Account Mastery scales is
enabled, the default calculation method was being stored as
weighted_average. This is incorrect and should be saved as
standard_decaying_average.

closes OUT-5897
flag=outcomes_new_decaying_average_calculation

test plan:
- tests pass in Jenkins

Change-Id: I172e320b95d462fafba943313fac17f2261a03c4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/327650
Reviewed-by: Kyle Rosenbaum <krosenbaum@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jason Anderson <jason.anderson@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
This commit is contained in:
Chrystal Langston 2023-09-13 12:42:07 -04:00 committed by Kyle Rosenbaum
parent c0afb73d5c
commit 966c194e50
3 changed files with 5 additions and 5 deletions

View File

@ -209,7 +209,7 @@ class LearningOutcome < ActiveRecord::Base
def default_calculation_method
if new_decaying_average_calculation_ff_enabled?
"weighted_average"
"standard_decaying_average"
else
"decaying_average"
end

View File

@ -334,7 +334,7 @@ RSpec.describe Outcomes::Import do
expect(existing_outcome.reload.calculation_method).to eq "decaying_average"
end
it "defaults to decaying_average if no calculation_method is given and feature_flag is ON" do
it "defaults to standard_decaying_average if no calculation_method is given and new Decaying Average FF is ON" do
context.root_account.enable_feature!(:outcomes_new_decaying_average_calculation)
expect(existing_outcome.reload.calculation_method).to eq "highest"
importer.import_outcome(
@ -342,7 +342,7 @@ RSpec.describe Outcomes::Import do
calculation_method: nil,
calculation_int: nil
)
expect(existing_outcome.reload.calculation_method).to eq "decaying_average"
expect(existing_outcome.reload.calculation_method).to eq "standard_decaying_average"
end
context "importing outcome into visible context" do

View File

@ -1152,9 +1152,9 @@ describe LearningOutcome do
LoadAccount.default_domain_root_account.enable_feature!(:outcomes_new_decaying_average_calculation)
end
it "defaults calculation_method to weighted_average" do
it "defaults calculation_method to standard_decaying_average" do
@outcome = LearningOutcome.create!(title: "outcome")
expect(@outcome.calculation_method).to eql("weighted_average")
expect(@outcome.calculation_method).to eql("standard_decaying_average")
expect(@outcome.calculation_int).to be 65
end