mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
source for data:
This commit is contained in:
parent
d9335206d8
commit
df594b9666
6 changed files with 53 additions and 34 deletions
|
|
@ -2,39 +2,45 @@
|
|||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
|
||||
.answers {
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #ccc;
|
||||
.question {
|
||||
.question-text {
|
||||
height: 3em;
|
||||
}
|
||||
|
||||
.answer {
|
||||
border-top: 1px solid #ccc;
|
||||
.answers {
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #ccc;
|
||||
|
||||
.text {
|
||||
width: 50%;
|
||||
}
|
||||
.answer {
|
||||
border-top: 1px solid #ccc;
|
||||
|
||||
td {
|
||||
line-height: 2em;
|
||||
div {
|
||||
margin: 0.25em 0;
|
||||
height: 1.5em;
|
||||
.text {
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
.bar0 {
|
||||
background-color: red;
|
||||
}
|
||||
.bar1 {
|
||||
background-color: orange;
|
||||
}
|
||||
.bar2 {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
.bar3 {
|
||||
background-color: green;
|
||||
}
|
||||
.bar4 {
|
||||
background-color: gray;
|
||||
td {
|
||||
line-height: 2em;
|
||||
div {
|
||||
margin: 0.25em 0;
|
||||
height: 1.5em;
|
||||
}
|
||||
}
|
||||
|
||||
.bar0 {
|
||||
background-color: red;
|
||||
}
|
||||
.bar1 {
|
||||
background-color: orange;
|
||||
}
|
||||
.bar2 {
|
||||
background-color: lightgreen;
|
||||
}
|
||||
.bar3 {
|
||||
background-color: green;
|
||||
}
|
||||
.bar4 {
|
||||
background-color: gray;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ class Question < ApplicationRecord
|
|||
|
||||
scope :for_category, -> (category) { where(category: category) }
|
||||
|
||||
enum target_group: [:unknown, :for_students, :for_teachers, :for_parents]
|
||||
|
||||
def source
|
||||
target_group.gsub('for_', '')
|
||||
end
|
||||
|
||||
def options
|
||||
[option1, option2, option3, option4, option5]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
.col-6.py-3
|
||||
.question.p-2{id: "question-#{question.id}"}
|
||||
%p.question-text.pt-3.px-2
|
||||
%b Question:
|
||||
= question.text
|
||||
|
||||
.pb-3.px-2
|
||||
|
|
@ -20,7 +19,7 @@
|
|||
= truncate(aggregated_responses.most_popular_answer, length: 27)
|
||||
%p
|
||||
%b Source:
|
||||
=# question.source(@school)
|
||||
= question.source.titleize
|
||||
|
||||
.clearfix
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
class AddTargetGroupToQuestion < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
add_column :questions, :target_group, :integer, default: 0
|
||||
end
|
||||
end
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20170312202259) do
|
||||
ActiveRecord::Schema.define(version: 20170316154053) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
|
@ -65,8 +65,9 @@ ActiveRecord::Schema.define(version: 20170312202259) do
|
|||
t.string "option4"
|
||||
t.string "option5"
|
||||
t.integer "category_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "target_group", default: 0
|
||||
end
|
||||
|
||||
create_table "recipient_lists", force: :cascade do |t|
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace :data do
|
|||
bad_answers = {}
|
||||
year = '2016'
|
||||
['student_responses', 'teacher_responses'].each do |file|
|
||||
# source = Measurement.sources[file.split('_')[0]]
|
||||
target_group = Question.target_groups["for_#{file.split('_')[0]}s"]
|
||||
csv_string = File.read(File.expand_path("../../../data/#{file}_#{year}.csv", __FILE__))
|
||||
csv = CSV.parse(csv_string, :headers => true)
|
||||
csv.each do |row|
|
||||
|
|
@ -179,6 +179,8 @@ namespace :data do
|
|||
puts "Unable to find question: #{key}"
|
||||
missing_questions[key] = true
|
||||
next
|
||||
else
|
||||
question.update_attributes(target_group: target_group) if question.unknown?
|
||||
end
|
||||
|
||||
answer_index = question.option_index(value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue