sqm-dashboards/app/models/housing.rb
rebuilt 0f457becf0 feat: create a parents by language graph
Update demographics table with lanugage options

Create a lanugage table to hold the new languages

Update the demographic loader to input languages into the database

Update the cleaner to read the language column

Update the parent table to hold a reference to a language

Update the data uploader script to read the language from the csv and update the language information for any parent items that already exist (or create database entries if none already exist)

update the analyze interface to add controls for selecting ‘parents by group’ and a dropdown for ‘parent by language’

Update the analyze controller to read the parent-by-group parameter

Create a graph for the parent-by-group view

Bubble up averages for language calculations.

Make sure n-size only counts responses for a given measure.
2025-04-28 16:42:11 -07:00

20 lines
413 B
Ruby

class Housing < ApplicationRecord
has_many :parents, dependent: :nullify
scope :by_designation, -> { all.map { |housing| [housing.designation, housing] }.to_h }
def self.to_designation(housing)
return "Unknown" if housing.blank?
housing = housing
case housing
in /^1$/i
"Own"
in /^2$/i
"Rent"
in /^99$|^100$/i
"Unknown"
else
"Unknown"
end
end
end