diff --git a/app/controllers/attempts_controller.rb b/app/controllers/attempts_controller.rb index 57576ea5..df5f3dae 100644 --- a/app/controllers/attempts_controller.rb +++ b/app/controllers/attempts_controller.rb @@ -14,9 +14,10 @@ class AttemptsController < ApplicationController attempt.update_attributes( answer_index: twilio_params[:Body].to_i, + responded_at: Time.new, twilio_details: twilio_params.to_h.to_yaml ) - render plain: 'Thank you!' + render plain: "We've registered your response of #{attempt.response)}. To see how others responded to the same question please visit " end # # GET /attempts/1/edit diff --git a/app/models/category.rb b/app/models/category.rb index f83c1ed9..9077dad4 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -29,7 +29,8 @@ class Category < ApplicationRecord "school-culture", "resources", "indicators-of-academic-learning", - "character-and-wellbeing-outcomes" + "character-and-wellbeing-outcomes", + "family-questions" ].index(root_identifier) end diff --git a/app/views/school_categories/_indicator.html.haml b/app/views/school_categories/_indicator.html.haml index 8a8b30af..04546636 100644 --- a/app/views/school_categories/_indicator.html.haml +++ b/app/views/school_categories/_indicator.html.haml @@ -2,7 +2,7 @@ - likert = info.answer_index_average - average_offset = (likert/num_likerts) * 100 - zones = ['Warning Zone: Schools that fall in this range are five or more years away from reaching community-wide targets. Consequently, this zone, as established by teachers, principals, parents, and district administrators, indicates that a school is in significant need of improvement. If the school is not in the Warning Zone in other areas, it may be a relatively successful school overall. Still, it must immediately develop a plan for addressing its shortcomings.', 'Watch Zone: Schools falling in this range are three or four years away from reaching community-wide targets. This zone, established by teachers, principals, parents, and district administrators, is not an ideal place for schools to be. But it does not mean that the school is failing. Instead, it means that the school needs to place particular emphasis on improving its work in this area.', 'Growth Zone: Schools falling in this range earned scores just below "acceptable." Yet these schools are close enough to the Approval Zone that they might reasonably reach it within two years. As established by teachers, principals, parents, and district administrators, this zone is an acceptable place for schools to be if they have the leadership, focus, and resources to improve their work in a particular area.', 'Approval Zone: Schools falling in this range earned scores between "acceptable" and "ideal." This zone, established by teachers, principals, parents, and district administrators, is the target that all schools should be striving to hit. Scoring in this range does not mean that a school is perfect; but it does mean that it is meeting or exceeding community-wide expectations in a particular category.', 'This area represents a set of outcomes so close to perfect that they are unlikely to be realized in any school.'] -- approval_zone = [[76, 90], [77, 91], [71, 85], [73, 86], [73, 86]][info.category.root_index] +- approval_zone = [[76, 90], [77, 91], [71, 85], [73, 86], [73, 86], [0,100]][info.category.root_index] - zone_widths = [0] - zone_widths << approval_zone[0] - (15 + 15) diff --git a/spec/controllers/attempts_controller_spec.rb b/spec/controllers/attempts_controller_spec.rb index 6817dc93..fde322c4 100644 --- a/spec/controllers/attempts_controller_spec.rb +++ b/spec/controllers/attempts_controller_spec.rb @@ -39,8 +39,11 @@ RSpec.describe AttemptsController, type: :controller do attempt.reload expect(attempt.answer_index).to eq(3) expect(attempt.twilio_details).to eq(twilio_attributes.with_indifferent_access.to_yaml) + expect(attempt.responded_at).to be_present + expect(first_attempt.answer_index).to be_nil expect(first_attempt.twilio_details).to be_nil + expect(first_attempt.responded_at).to be_nil end it "sends back a message" do