Skip to content

Commit

Permalink
Remove Confusing TII setting
Browse files Browse the repository at this point in the history
closes PLAT-3774

Test Plan:
 - Go to a root account, see that the confusion is gone
 - Go to a subaccount, things are the same

Change-Id: I9f1cd14fd04135a19027f3bfd25360a043263649
Reviewed-on: https://gerrit.instructure.com/167219
Reviewed-by: Weston Dransfield <[email protected]>
QA-Review: Weston Dransfield <[email protected]>
Tested-by: Jenkins
Product-Review: Marc Phillips <[email protected]>
  • Loading branch information
Marc Phillips committed Oct 5, 2018
1 parent 4d45d00 commit 91a1afa
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
6 changes: 3 additions & 3 deletions app/helpers/accounts_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def show_code_and_term_for(course)
"#{course.course_code if show_code}#{', ' if show_term && show_code}#{course.enrollment_term.name if show_term}"
end

def turnitin_originality_options
def turnitin_originality_options(account)
[
[I18n.t('Use parent account setting'), nil],
account.root_account? ? nil : [I18n.t('Use parent account setting'), nil],
[I18n.t('#turnitin_settings.originality_report_visible_immediately', "Immediately"), 'immediate'],
[I18n.t('#turnitin_settings.originality_report_visible_after_grading', "After the assignment is graded"), 'after_grading'],
[I18n.t('#turnitin_settings.originality_report_visible_after_due_date', "After the Due Date"), 'after_due_date'],
[I18n.t('#turnitin_settings.originality_report_never', "Never"), 'never']
]
].compact
end

def dashboard_view_options(account)
Expand Down
2 changes: 1 addition & 1 deletion app/views/accounts/settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@
<tr>
<td><label for="account_turnitin_originality"><%= I18n.t('Students can see originality score') %></label></td>
<td>
<%= f.select :turnitin_originality, options_for_select(turnitin_originality_options, @account.turnitin_originality)%>
<%= f.select :turnitin_originality, options_for_select(turnitin_originality_options(@account), @account.turnitin_originality)%>
</td>
</tr>
</table>
Expand Down
33 changes: 24 additions & 9 deletions spec/helpers/accounts_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,31 @@

describe AccountsHelper do
include AccountsHelper
let_once(:account) { Account.create! }
let(:subaccount) { account.sub_accounts.create! }

describe 'turnitin_originality_options' do
it 'contains the expected options' do
expect(turnitin_originality_options.map(&:first)).to match_array [
'Use parent account setting',
'Immediately',
'After the assignment is graded',
'After the Due Date',
'Never'
]
context 'with subaccount' do
it 'contains the expected options' do
expect(turnitin_originality_options(subaccount).map(&:first)).to match_array [
'Use parent account setting',
'Immediately',
'After the assignment is graded',
'After the Due Date',
'Never'
]
end
end

context 'with root account' do
it 'contains the expected options' do
expect(turnitin_originality_options(account).map(&:first)).to match_array [
'Immediately',
'After the assignment is graded',
'After the Due Date',
'Never'
]
end
end
end
end
end

0 comments on commit 91a1afa

Please sign in to comment.