Outcome Export - handling account mastery scales
closes: OUT-3973 flag = account_level_mastery_scales test plan: 1.Create account level outcome, fill out the description 2.Check that new outcome has ratings and calculation method 3.Run the Outcome_export report 4.Turn on FF 5.Re-run the Outcome_export report 6.Validate the presence of score information in first report 7.Validate the absence of score information in second 8.Validate all other information is the same 9.Check the updated information button Change-Id: I61032f4ae16cb9b5b78ab31c9992b9da20b05a76 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/252211 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Augusto Callejas <acallejas@instructure.com> Reviewed-by: Pat Renner <prenner@instructure.com> QA-Review: Pat Renner <prenner@instructure.com> Product-Review: Jody Sailor
This commit is contained in:
parent
5285cd9f22
commit
b03b00a36a
|
@ -100,3 +100,60 @@ all associated attributes with each outcome.}) %></p>
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><%= t(%{If mastery scales are enabled, the report will be truncated to not include calculation method,
|
||||
calculation int, mastery points, or ratings }) %></p>
|
||||
|
||||
<h3><%= t(%{Example}) %></h3>
|
||||
|
||||
<table class="report_example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>vendor_guid</th>
|
||||
<th>object_type</th>
|
||||
<th>title</th>
|
||||
<th>description</th>
|
||||
<th>display_name</th>
|
||||
<th>parent_guids</th>
|
||||
<th>workflow_state</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>a00201</td>
|
||||
<td>outcome_group</td>
|
||||
<td>Mathematics</td>
|
||||
<td>Standards related to mathematics</td>
|
||||
<td>MATH</td>
|
||||
<td></td>
|
||||
<td>active</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>a00202</td>
|
||||
<td>outcome_group</td>
|
||||
<td>Mathematics Grade 2</td>
|
||||
<td>Standards related to mathematics, grade 2</td>
|
||||
<td>MATH-2</td>
|
||||
<td>a00201</td>
|
||||
<td>active</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>canvas_outcome:81</td>
|
||||
<td>outcome</td>
|
||||
<td>Order of Operations, +/-</td>
|
||||
<td>Students will be able add and subtract using parentheses to define order of operations</td>
|
||||
<td>MATH-2-OO</td>
|
||||
<td>a00201 a00202</td>
|
||||
<td>deleted</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>g0335</td>
|
||||
<td>outcome</td>
|
||||
<td>Order of Operations, ×/÷</td>
|
||||
<td>Students will be able multiply and divide using parentheses to define order of operations</td>
|
||||
<td>MATH-2-O1</td>
|
||||
<td>a00201</td>
|
||||
<td>active</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -29,25 +29,24 @@ module AccountReports
|
|||
include_deleted_objects
|
||||
end
|
||||
|
||||
OUTCOME_EXPORT_SCALAR_HEADERS = [
|
||||
'vendor_guid',
|
||||
'object_type',
|
||||
'title',
|
||||
'description',
|
||||
'display_name',
|
||||
'calculation_method',
|
||||
'calculation_int',
|
||||
'parent_guids',
|
||||
'workflow_state',
|
||||
'mastery_points'
|
||||
].freeze
|
||||
|
||||
NO_SCORE_HEADERS = %w(vendor_guid object_type title description display_name parent_guids workflow_state).freeze
|
||||
OUTCOME_EXPORT_SCALAR_HEADERS = %w(vendor_guid object_type title description display_name calculation_method \
|
||||
calculation_int parent_guids workflow_state mastery_points).freeze
|
||||
OUTCOME_EXPORT_HEADERS = (OUTCOME_EXPORT_SCALAR_HEADERS + ['ratings']).freeze
|
||||
|
||||
def outcome_export
|
||||
enable_i18n_features = true
|
||||
write_report OUTCOME_EXPORT_HEADERS, enable_i18n_features do |csv|
|
||||
export_outcome_groups(csv)
|
||||
export_outcomes(csv)
|
||||
if @account_report.account.root_account.feature_enabled?(:account_level_mastery_scales)
|
||||
write_report NO_SCORE_HEADERS, enable_i18n_features do |csv|
|
||||
export_outcome_groups(csv, NO_SCORE_HEADERS)
|
||||
export_outcomes(csv, NO_SCORE_HEADERS, false)
|
||||
end
|
||||
else
|
||||
write_report OUTCOME_EXPORT_HEADERS, enable_i18n_features do |csv|
|
||||
export_outcome_groups(csv, OUTCOME_EXPORT_SCALAR_HEADERS)
|
||||
export_outcomes(csv, OUTCOME_EXPORT_SCALAR_HEADERS, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -101,10 +100,10 @@ module AccountReports
|
|||
SQL
|
||||
end
|
||||
|
||||
def export_outcome_groups(csv)
|
||||
def export_outcome_groups(csv, headers)
|
||||
outcome_group_scope.each do |row|
|
||||
row['object_type'] = 'group'
|
||||
csv << OUTCOME_EXPORT_SCALAR_HEADERS.map { |h| row[h] }
|
||||
csv << headers.map { |h| row[h] }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -138,7 +137,7 @@ module AccountReports
|
|||
SQL
|
||||
end
|
||||
|
||||
def export_outcomes(csv)
|
||||
def export_outcomes(csv, headers, include_ratings)
|
||||
I18n.locale = account.default_locale if account.default_locale.present?
|
||||
outcome_scope.find_each do |row|
|
||||
outcome_model = row.learning_outcome_content
|
||||
|
@ -146,10 +145,9 @@ module AccountReports
|
|||
outcome['object_type'] = 'outcome'
|
||||
criterion = outcome_model.rubric_criterion
|
||||
outcome['mastery_points'] = I18n.n(criterion[:mastery_points])
|
||||
|
||||
csv_row = OUTCOME_EXPORT_SCALAR_HEADERS.map { |h| outcome[h] }
|
||||
csv_row = headers.map { |h| outcome[h] }
|
||||
ratings = criterion[:ratings]
|
||||
if ratings.present?
|
||||
if ratings.present? && include_ratings
|
||||
csv_row += ratings.flat_map do |r|
|
||||
r.values_at(:points, :description).tap do |p|
|
||||
p[0] = I18n.n(p[0]) if p[0]
|
||||
|
|
|
@ -48,7 +48,7 @@ describe "Outcome Reports" do
|
|||
report.find { |row| match_outcome(object).matches?(row) }
|
||||
end
|
||||
|
||||
def have_n_ratings(n)
|
||||
def n_ratings?(n)
|
||||
satisfy("have #{n} ratings") do |row|
|
||||
row.length - RATING_INDEX == 2 * n
|
||||
end
|
||||
|
@ -221,6 +221,18 @@ describe "Outcome Reports" do
|
|||
expect(other['calculation_int']).to eq '5'
|
||||
end
|
||||
|
||||
it 'ignores fields when account level mastery scales are enabled' do
|
||||
@account.set_feature_flag!(:account_level_mastery_scales, 'on')
|
||||
expect(report.length).to eq 4
|
||||
report.each do |r|
|
||||
expect(r).to_not have_key('mastery_points')
|
||||
expect(r).to_not have_key('calculation_method')
|
||||
expect(r).to_not have_key('calculation_int')
|
||||
expect(r).to_not have_key('ratings')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
it 'does not include deleted outcomes' do
|
||||
@root_outcome_2.destroy!
|
||||
expect(report.length).to eq 3
|
||||
|
@ -277,7 +289,7 @@ describe "Outcome Reports" do
|
|||
let(:first_outcome) { find_object(@root_outcome_1) }
|
||||
|
||||
it 'includes all ratings' do
|
||||
expect(first_outcome).to have_n_ratings(2)
|
||||
expect(first_outcome).to n_ratings?(2)
|
||||
expect(first_outcome[RATING_INDEX]).to eq '3.0'
|
||||
expect(first_outcome[RATING_INDEX + 1]).to eq 'Rockin'
|
||||
expect(first_outcome[RATING_INDEX + 2]).to eq '0.0'
|
||||
|
@ -296,7 +308,7 @@ describe "Outcome Reports" do
|
|||
]
|
||||
}
|
||||
@root_outcome_1.save!
|
||||
expect(first_outcome).to have_n_ratings(6)
|
||||
expect(first_outcome).to n_ratings?(6)
|
||||
expect(first_outcome[RATING_INDEX]).to eq '10.0'
|
||||
expect(first_outcome[RATING_INDEX + 1]).to eq 'a fly'
|
||||
expect(first_outcome[RATING_INDEX + 10]).to eq '0.0'
|
||||
|
|
Loading…
Reference in New Issue