Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch scored AP-related question and fix auto-score #19959

Merged
merged 4 commits into from
Jan 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def auto_score!
scores[:csp_which_grades] = responses[:csp_which_grades].any? ? YES : NO
scores[:csp_course_hours_per_year] = responses[:csp_course_hours_per_year] == COMMON_OPTIONS[:course_hours_per_year].first ? YES : NO
scores[:previous_yearlong_cdo_pd] = responses[:previous_yearlong_cdo_pd].exclude?('CS Principles') ? YES : NO
scores[:csp_ap_exam] = responses[:csp_ap_exam] != Pd::Application::Teacher1819Application.options[:csp_ap_exam].last ? YES : NO
scores[:csp_how_offer] = responses[:csp_how_offer] != Pd::Application::Teacher1819Application.options[:csp_how_offer].first ? 2 : 0
scores[:taught_in_past] = responses[:taught_in_past].none? {|x| x.include? 'AP'} ? 2 : 0
elsif course == 'csd'
scores[:csd_which_grades] = (responses[:csd_which_grades].map(&:to_i) & (6..10).to_a).any? ? YES : NO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class PrincipalApprovalApplicationsControllerTest < ::ActionController::TestCase
csp_which_grades: YES,
csp_course_hours_per_year: YES,
previous_yearlong_cdo_pd: YES,
csp_ap_exam: YES,
csp_how_offer: 2,
taught_in_past: 2,
schedule_confirmed: YES,
diversity_recruitment: YES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TeacherApplicationsControllerTest < ::ActionController::TestCase
csp_which_grades: YES,
csp_course_hours_per_year: YES,
previous_yearlong_cdo_pd: YES,
csp_ap_exam: YES,
csp_how_offer: 2,
taught_in_past: 2
}, Pd::Application::Teacher1819Application.last.response_scores_hash
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: ['12'],
csp_course_hours_per_year: Pd::Application::ApplicationBase::COMMON_OPTIONS[:course_hours_per_year].first,
previous_yearlong_cdo_pd: ['CS Discoveries'],
csp_ap_exam: Pd::Application::Teacher1819Application.options[:csp_ap_exam].first,
csp_how_offer: Pd::Application::Teacher1819Application.options[:csp_how_offer].last,
taught_in_past: ['CS in Algebra']
}
)
Expand All @@ -98,7 +98,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: YES,
csp_course_hours_per_year: YES,
previous_yearlong_cdo_pd: YES,
csp_ap_exam: YES,
csp_how_offer: 2,
taught_in_past: 2
}, application.response_scores_hash
)
Expand All @@ -117,7 +117,6 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
application.update(response_scores: application.response_scores_hash.merge({regional_partner_name: NO}).to_json)

application.auto_score!
application.reload
assert_equal(
{
regional_partner_name: NO,
Expand All @@ -132,7 +131,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: YES,
csp_course_hours_per_year: YES,
previous_yearlong_cdo_pd: YES,
csp_ap_exam: YES,
csp_how_offer: 2,
taught_in_past: 2
}, application.response_scores_hash
)
Expand All @@ -153,7 +152,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: ['12'],
csp_course_hours_per_year: Pd::Application::ApplicationBase::COMMON_OPTIONS[:course_hours_per_year].first,
previous_yearlong_cdo_pd: ['CS Discoveries'],
csp_ap_exam: Pd::Application::Teacher1819Application.options[:csp_ap_exam].first,
csp_how_offer: Pd::Application::Teacher1819Application.options[:csp_how_offer].last,
taught_in_past: ['CS in Algebra']
}
)
Expand All @@ -176,7 +175,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: YES,
csp_course_hours_per_year: YES,
previous_yearlong_cdo_pd: YES,
csp_ap_exam: YES,
csp_how_offer: 2,
taught_in_past: 2
}, application.response_scores_hash
)
Expand All @@ -197,7 +196,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: ['12'],
csp_course_hours_per_year: Pd::Application::ApplicationBase::COMMON_OPTIONS[:course_hours_per_year].last,
previous_yearlong_cdo_pd: ['CS Principles'],
csp_ap_exam: Pd::Application::Teacher1819Application.options[:csp_ap_exam].last,
csp_how_offer: Pd::Application::Teacher1819Application.options[:csp_how_offer].first,
taught_in_past: ['AP CS A']
}
)
Expand All @@ -219,7 +218,7 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
csp_which_grades: YES, # Not possible to select responses for which this would be No
csp_course_hours_per_year: NO,
previous_yearlong_cdo_pd: NO,
csp_ap_exam: NO,
csp_how_offer: 0,
taught_in_past: 0
}, application.response_scores_hash
)
Expand Down Expand Up @@ -379,18 +378,15 @@ class Teacher1819ApplicationTest < ActiveSupport::TestCase
assert_nil application.accepted_at

Timecop.freeze(today) do
application.update(status: 'accepted')
application.reload
application.update!(status: 'accepted')
assert_equal today, application.accepted_at.to_time

application.update(status: 'declined')
application.reload
application.update!(status: 'declined')
assert_nil application.accepted_at
end

Timecop.freeze(tomorrow) do
application.update(status: 'accepted')
application.reload
application.update!(status: 'accepted')
assert_equal tomorrow, application.accepted_at.to_time
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def self.clean_multiline(string)
underrepresented_minority_percent: [5, 0],
wont_replace_existing_course: [5, 0],
taught_in_past: [2, 0],
csp_ap_exam: [2, 0]
csp_how_offer: [2, 0]
}.freeze

ALL_LABELS = PAGE_LABELS.values.reduce(:merge).freeze
Expand All @@ -207,6 +207,6 @@ def self.clean_multiline(string)
).freeze
CRITERIA_SCORE_QUESTIONS_CSD = (
VALID_SCORES.select {|_, v| v == YES_NO}.keys -
[:csp_ap_exam, :csp_which_grades, :csp_course_hours_per_year]
[:csp_how_offer, :csp_which_grades, :csp_course_hours_per_year]
).freeze
end