Class: Lcms::Engine::Standard

Inherits:
ApplicationRecord show all
Defined in:
app/models/lcms/engine/standard.rb

Constant Summary collapse

ALT_NAME_REGEX =

NOTE: #954 - to be removed?

{
  'ela' => /^[[:alpha:]]+\.(k|pk|\d+)\.\d+(\.[[:alnum:]]+)?$/,
  'math' => /^(k|pk|\d+)\.[[:alpha:]]+(\.[[:alpha:]]+)?\.\d+(\.[[:alpha:]]+)?$/
}.freeze
DOMAINS_GRADES =
{
  'K_8' => ['k'].concat((1..8).to_a.map(&:to_s)),
  '9_12' => (9..12).to_a.map(&:to_s)
}.freeze
DOMAINS =
{
  'K_8' => {
    'CC' => 'Counting & Cardinality',
    'OA' => 'Operations & Algebraic Thinking',
    'NBT' => 'Number & Operations in Base Ten',
    'MD' => 'Measurement & Data',
    'G' => 'Geometry',
    'NF' => 'Number & Operations—Fractions',
    'RP' => 'Ratios & Proportional Relationships',
    'NS' => 'The Number System',
    'EE' => 'Expressions & Equations',
    'SP' => 'Statistics & Probability',
    'F' => 'Functions'
  },
  '9_12' => {
    'RN' => 'The Real Number System',
    'Q' => 'Quantities*',
    'CN' => 'The Complex Number System',
    'VM' => 'Vector & Matrix Quantities',
    'SSE' => 'Seeing Structure in Expressions',
    'APR' => 'Arithmetic with Polynomials & Rational Expressions',
    'CED' => 'Creating Equations*',
    'REI' => 'Reasoning with Equations & Inequalities',
    'IF' => 'Interpreting Functions',
    'BF' => 'Building Functions',
    'LE' => 'Linear, Quadratic, & Exponential Models*',
    'TF' => 'Trigonometric Functions',
    'CO' => 'Congruence',
    'SRT' => 'Similarity, Right Triangles, & Trigonometry',
    'C' => 'Circles',
    'GPE' => 'Expressing Geometric Properties with Equations',
    'GMD' => 'Geometric Measurement & Dimension',
    'MG' => 'Modeling with Geometry',
    'ID' => 'Interpreting Categorical & Quantitative Data',
    'IC' => 'Making Inferences & Justifying Conclusions',
    'CP' => 'Conditional Probability & the Rules of Probability',
    'MD' => 'Using Probability to Make Decisions'
  }
}.freeze
STRANDS =
{
  'L' => 'Language',
  'RF' => 'Reading: Foundational Skills',
  'RI' => 'Reading: Informational Text',
  'RL' => 'Reading: Literature',
  'SL' => 'Speaking & Listening',
  'W' => 'Writing'
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.filter_ccss_standards(name, subject) ⇒ Object

NOTE: #954 - to be removed?



89
90
91
# File 'app/models/lcms/engine/standard.rb', line 89

def self.filter_ccss_standards(name, subject)
  name&.match?(ALT_NAME_REGEX[subject]) ? name.upcase : nil
end

.search_by_name(name) ⇒ Object

NOTE: #954 - to be removed?



84
85
86
# File 'app/models/lcms/engine/standard.rb', line 84

def self.search_by_name(name)
  where('name ILIKE :q OR alt_names::text ILIKE :q', q: "%#{name}%").order(:id)
end

Instance Method Details

#short_nameObject

NOTE: #954 - to be removed?



94
95
96
# File 'app/models/lcms/engine/standard.rb', line 94

def short_name
  alt_names.map { |n| self.class.filter_ccss_standards(n, subject) }.compact.try(:first) || name
end