mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add counter caches
This commit is contained in:
parent
c03615cb43
commit
a6ad132c81
21 changed files with 141 additions and 34 deletions
|
|
@ -44,7 +44,7 @@ describe ResponseRateLoader do
|
|||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
describe 'self.refresh' do
|
||||
describe 'self.reset' do
|
||||
context 'When refreshing response rates' do
|
||||
context 'and half the students responded to each question' do
|
||||
before :each do
|
||||
|
|
@ -58,7 +58,7 @@ describe ResponseRateLoader do
|
|||
create_list(:survey_item_response, 5, survey_item: t_phya_q2, likert_score: 3, school:, academic_year:)
|
||||
create_list(:survey_item_response, 5, survey_item: t_phya_q3, likert_score: 3, school:, academic_year:)
|
||||
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
end
|
||||
|
||||
it 'populates the database with response rates' do
|
||||
|
|
@ -76,7 +76,7 @@ describe ResponseRateLoader do
|
|||
context 'when running the loader a second time' do
|
||||
it 'is idempotent' do
|
||||
response_count = ResponseRate.count
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
second_count = ResponseRate.count
|
||||
|
||||
expect(response_count).to eq second_count
|
||||
|
|
@ -90,7 +90,7 @@ describe ResponseRateLoader do
|
|||
create_list(:survey_item_response, 5, survey_item: s_poaf_q1, likert_score: 3, school:, academic_year:)
|
||||
create_list(:survey_item_response, 5, survey_item: t_phya_q2, likert_score: 3, school:, academic_year:)
|
||||
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
end
|
||||
|
||||
it 'only takes into account the first question and ignores the other questions in the scale' do
|
||||
|
|
@ -106,7 +106,7 @@ describe ResponseRateLoader do
|
|||
create_list(:survey_item_response, 5, survey_item: s_poaf_q1, likert_score: 3, school:, academic_year:)
|
||||
create_list(:survey_item_response, 5, survey_item: t_phya_q2, likert_score: 3, school:, academic_year:)
|
||||
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
end
|
||||
|
||||
it 'since no score can be calculated, it returns a default of 100' do
|
||||
|
|
@ -128,7 +128,7 @@ describe ResponseRateLoader do
|
|||
create_list(:survey_item_response, 1, survey_item: t_phya_q3, likert_score: 3, school:, academic_year:)
|
||||
short_form_survey
|
||||
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
end
|
||||
|
||||
it 'only counts responses from survey items on the short form' do
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ describe 'analyze/index' do
|
|||
end
|
||||
|
||||
it 'displays disabled checkboxes for years that dont have data' do
|
||||
ResponseRateLoader.refresh
|
||||
ResponseRateLoader.reset
|
||||
year_checkbox = subject.css("##{academic_year.range}").first
|
||||
expect(year_checkbox.name).to eq 'input'
|
||||
expect(academic_year.range).to eq '2050-51'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue