From 68734633ed06eb2e455a07ce48ce1d61dd0d5c8c Mon Sep 17 00:00:00 2001 From: Sergei Alekseenko Date: Tue, 23 Jun 2026 21:35:41 +0400 Subject: [PATCH] (#73) Change metadata specs for units and lessons --- app/presenters/unit_presenter.rb | 4 ++-- docs/core/lesson-metadata-specs.md | 8 ++++---- docs/core/material-metadata-specification.md | 2 +- docs/unit-metadata-spec.md | 8 ++++---- lib/doc_template/objects/activity.rb | 2 +- lib/doc_template/objects/unit.rb | 4 ++-- lib/doc_template/tables/activity.rb | 4 ++-- lib/doc_template/tables/unit.rb | 2 +- spec/fixtures/tables/activity-metadata-valid.html | 2 +- spec/fixtures/tables/unit-metadata.html | 8 +++----- spec/lib/doc_template/objects/unit_spec.rb | 12 ++++++------ spec/lib/doc_template/tables/unit_spec.rb | 4 ++-- spec/services/unit_resource_upsert_service_spec.rb | 2 +- 13 files changed, 30 insertions(+), 32 deletions(-) diff --git a/app/presenters/unit_presenter.rb b/app/presenters/unit_presenter.rb index ca6183d..bcf7cf5 100644 --- a/app/presenters/unit_presenter.rb +++ b/app/presenters/unit_presenter.rb @@ -3,9 +3,9 @@ class UnitPresenter < BasePresenter include HasGdocSource - delegate :acknowledgements, :copyright, :course, :description, :license, + delegate :copyright, :course_name, :description, :license, :unit_id, :unit_title_spanish, :unit_topic, :unit_topic_spanish, - to: :base_metadata + :version, to: :base_metadata def bundle_folder(bundle_type = nil) folder = "#{BUNDLE_S3_FOLDER}" diff --git a/docs/core/lesson-metadata-specs.md b/docs/core/lesson-metadata-specs.md index a4748a4..116ec79 100644 --- a/docs/core/lesson-metadata-specs.md +++ b/docs/core/lesson-metadata-specs.md @@ -8,7 +8,7 @@ | lesson-title | text | | lesson-title-Spanish | text; can be blank | | lesson-label | Options: required, optional; can be blank | -| lesson-type | text Options: | +| lesson-type | text; can be blank Options: (client defined; not validated) | | standards | unique alphanumeric codes; comma separated list (e.g., MS-ESS2-4, MS-ESS2-5); codes will connect to spreadsheet with standards language for rendering | | description | text that describes the lesson: “In this lesson, we…” | | description-past | text that describes the lesson in past tense language; “In the previous lesson, we…”; will be blank for the last lesson of a unit | @@ -30,7 +30,7 @@ | activity-time | number | | activity-description | Text; can be blank | | activity-label | Options: required, optional; can be blank | -| activity-type | text or unique alphanumeric code; can be blank Options: | +| activity-type | text; can be blank Options: (client defined; not validated) | | activity-type-purpose | text; can be blank | | slide-id | text; can be blank | | lms-enabled | Yes or No | @@ -44,12 +44,12 @@ | grading-required | Yes or No | | grading-format | text; can be blank Options: completion, points (If we remove grading-required and this is blank, then grading-required \= No; if this is filled out then grading-required \= Yes) | | total-points | Text; can be blank | -| student-grouping | Options: individual, partners, small group, class | +| student-grouping | Options: individual, partners, group, class | | activity-materials-student | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | | activity-materials-pair | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | | activity-materials-group | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | | activity-materials-class | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | -| activity-metadata-teacher | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | +| activity-materials-teacher | text, comma separated list; use the \[material\] tag for LCMS-generated materials; can be blank | | vocabulary | text, comma separated list; can be blank | | \[lms-materials\] | | diff --git a/docs/core/material-metadata-specification.md b/docs/core/material-metadata-specification.md index bb47ac9..cf869c6 100644 --- a/docs/core/material-metadata-specification.md +++ b/docs/core/material-metadata-specification.md @@ -3,7 +3,7 @@ | subject | | | grade | | | material-id | unique alphanumeric code | -| material-type | unique codes (e.g., Handout, Reference, Link); system needs to handle and specify both internal and external materials | +| material-type | unique codes; system needs to handle and specify both internal and external materials. Options: handout, reference, link, key, assessment, overview, acknowledgements | | material-title | text | | material-title-Spanish | | | material-order | numerical value \= or \> than 0 used to indicate the material \# relative to other materials used in the same lesson (e.g. “Student Handout 1” vs. “Student Handout 2”). If value \= 0 or left blank then number should not be rendered (i.e. “Student Handout” not “Student Handout 0”) | diff --git a/docs/unit-metadata-spec.md b/docs/unit-metadata-spec.md index 5e1e998..dc52e6b 100644 --- a/docs/unit-metadata-spec.md +++ b/docs/unit-metadata-spec.md @@ -12,7 +12,7 @@ This document defines the `unit-metadata` table expected in Google Docs sources. | :---- | :---- | :---- | | `subject` | text | Required | | `grade` | number | Required | -| `course` | text | Optional, can be blank | +| `course-name` | text | Optional, can be blank | | `unit-id` | unique alphanumeric id | Required | | `unit-title` | text | Required | | `unit-title-Spanish` | text | Optional, can be blank | @@ -21,7 +21,7 @@ This document defines the `unit-metadata` table expected in Google Docs sources. | `description` | text | Required | | `copyright` | text | Optional, can be blank | | `license` | text | Optional, can be blank | -| `acknowledgements` | text | Optional, can be blank | +| `version` | text | Optional, tracks the unit version | | `unit-materials` | comma separated list | Materials aligned to the unit level, using material ids | ## Validation Expectations @@ -32,7 +32,7 @@ This document defines the `unit-metadata` table expected in Google Docs sources. `grade` : required numeric value -`course` +`course-name` : optional text value `unit-id` @@ -59,7 +59,7 @@ This document defines the `unit-metadata` table expected in Google Docs sources. `license` : optional text value -`acknowledgements` +`version` : optional text value `unit-materials` diff --git a/lib/doc_template/objects/activity.rb b/lib/doc_template/objects/activity.rb index 88ceeca..efdbfc6 100644 --- a/lib/doc_template/objects/activity.rb +++ b/lib/doc_template/objects/activity.rb @@ -21,7 +21,7 @@ class Item < Base attribute :activity_materials_pair, :string attribute :activity_materials_group, :string attribute :activity_materials_class, :string - attribute :activity_metadata_teacher, :string + attribute :activity_materials_teacher, :string attribute :activity_standard, :string attribute :activity_mathematical_practice, :string attribute :activity_metacognition, :string diff --git a/lib/doc_template/objects/unit.rb b/lib/doc_template/objects/unit.rb index 9dba516..700b481 100644 --- a/lib/doc_template/objects/unit.rb +++ b/lib/doc_template/objects/unit.rb @@ -3,9 +3,8 @@ module DocTemplate module Objects class Unit < Base - attribute :acknowledgements, :string, default: "" attribute :copyright, :string, default: "" - attribute :course, :string, default: "" + attribute :course_name, :string, default: "" attribute :description, :string, default: "" attribute :grade, :string, default: "" attribute :license, :string, default: "" @@ -16,6 +15,7 @@ class Unit < Base attribute :unit_title_spanish, :string, default: "" attribute :unit_topic, :string, default: "" attribute :unit_topic_spanish, :string, default: "" + attribute :version, :string, default: "" end end end diff --git a/lib/doc_template/tables/activity.rb b/lib/doc_template/tables/activity.rb index eca2d6e..3de072a 100644 --- a/lib/doc_template/tables/activity.rb +++ b/lib/doc_template/tables/activity.rb @@ -7,8 +7,8 @@ class Activity < Base HTML_VALUE_FIELDS = %w(activity-description).freeze MATERIALS_KEYS = %w(activity-materials-student activity-materials-pair activity-materials-group activity-materials-class - activity-metadata-teacher).freeze - GROUPING_OPTIONS = ["individual", "partners", "small group", "class"].freeze + activity-materials-teacher).freeze + GROUPING_OPTIONS = %w(individual partners group class).freeze LMS_TYPE_OPTIONS = %w(assignment discussion assessment reference).freeze LMS_FIELDS = %w(lms-title lms-title-spanish lms-instructions lms-instructions-spanish lms-type).freeze diff --git a/lib/doc_template/tables/unit.rb b/lib/doc_template/tables/unit.rb index 3d2aeb1..e758d63 100644 --- a/lib/doc_template/tables/unit.rb +++ b/lib/doc_template/tables/unit.rb @@ -4,7 +4,7 @@ module DocTemplate module Tables class Unit < Base HEADER_LABEL = "unit-metadata" - HTML_VALUE_FIELDS = %w(description acknowledgements).freeze + HTML_VALUE_FIELDS = %w(description).freeze MATERIALS_KEY = "unit-materials" REQUIRED_FIELDS = %w(subject grade unit-id unit-title unit-topic description).freeze UNIT_ID_REGEX = /\A[a-z0-9]+\z/i diff --git a/spec/fixtures/tables/activity-metadata-valid.html b/spec/fixtures/tables/activity-metadata-valid.html index ab49173..38a8613 100644 --- a/spec/fixtures/tables/activity-metadata-valid.html +++ b/spec/fixtures/tables/activity-metadata-valid.html @@ -7,7 +7,7 @@ activity-metadata activity-titleWarm Up - student-groupingsmall group + student-groupinggroup lms-enabledYes lms-typeassignment lms-titleWarm Up Activity diff --git a/spec/fixtures/tables/unit-metadata.html b/spec/fixtures/tables/unit-metadata.html index 0eba1ba..956fca8 100644 --- a/spec/fixtures/tables/unit-metadata.html +++ b/spec/fixtures/tables/unit-metadata.html @@ -15,7 +15,7 @@

6

-

course

+

course-name

Algebra

@@ -53,10 +53,8 @@

CC BY-NC

-

acknowledgements

- -

Created with district partners.

- +

version

+

1.0

unit-materials

diff --git a/spec/lib/doc_template/objects/unit_spec.rb b/spec/lib/doc_template/objects/unit_spec.rb index 4180416..0f61aed 100644 --- a/spec/lib/doc_template/objects/unit_spec.rb +++ b/spec/lib/doc_template/objects/unit_spec.rb @@ -8,9 +8,8 @@ it "defaults string attributes to empty string" do %i( - acknowledgements copyright - course + course_name description grade license @@ -20,6 +19,7 @@ unit_title_spanish unit_topic unit_topic_spanish + version ).each do |attr| expect(unit.public_send(attr)).to eq("") end @@ -39,7 +39,7 @@ { "Subject" => "math", "Grade" => "6", - "Course" => "Algebra", + "Course-Name" => "Algebra", "Unit-ID" => "M6U1A", "Unit-Title" => "Expressions and Equations", "Unit-Title-Spanish" => "Expresiones y ecuaciones", @@ -48,7 +48,7 @@ "Description" => "

Unit description

", "Copyright" => "Learning Tapestry", "License" => "CC BY-NC", - "Acknowledgements" => "

Thanks

", + "Version" => "1.0", "Material-Ids" => [1, 2] } end @@ -58,7 +58,7 @@ it "maps metadata keys to unit attributes" do expect(unit.subject).to eq("math") expect(unit.grade).to eq("6") - expect(unit.course).to eq("Algebra") + expect(unit.course_name).to eq("Algebra") expect(unit.unit_id).to eq("M6U1A") expect(unit.unit_title).to eq("Expressions and Equations") expect(unit.unit_title_spanish).to eq("Expresiones y ecuaciones") @@ -67,7 +67,7 @@ expect(unit.description).to eq("

Unit description

") expect(unit.copyright).to eq("Learning Tapestry") expect(unit.license).to eq("CC BY-NC") - expect(unit.acknowledgements).to eq("

Thanks

") + expect(unit.version).to eq("1.0") expect(unit.material_ids).to eq([1, 2]) end end diff --git a/spec/lib/doc_template/tables/unit_spec.rb b/spec/lib/doc_template/tables/unit_spec.rb index 5f50bdc..eaa857e 100644 --- a/spec/lib/doc_template/tables/unit_spec.rb +++ b/spec/lib/doc_template/tables/unit_spec.rb @@ -22,7 +22,7 @@ expect(parsed_table.data).to include( "subject" => "math", "grade" => "6", - "course" => "Algebra", + "course-name" => "Algebra", "unit-id" => "m6u1a", "unit-title" => "Expressions and Equations", "unit-title-spanish" => "Expresiones y ecuaciones", @@ -30,6 +30,7 @@ "unit-topic-spanish" => "Relaciones entre variables", "copyright" => "Learning Tapestry", "license" => "CC BY-NC", + "version" => "1.0", "unit-materials" => "MAT-1, MAT-2" ) end @@ -40,7 +41,6 @@ it "preserves html fields" do expect(parsed_table.data["description"]).to include("

") - expect(parsed_table.data["acknowledgements"]).to include("

") end it "resolves unit materials to material ids" do diff --git a/spec/services/unit_resource_upsert_service_spec.rb b/spec/services/unit_resource_upsert_service_spec.rb index 87d5b22..4d9efc8 100644 --- a/spec/services/unit_resource_upsert_service_spec.rb +++ b/spec/services/unit_resource_upsert_service_spec.rb @@ -8,7 +8,7 @@ { "subject" => "math", "grade" => "6", - "course" => "Algebra", + "course-name" => "Algebra", "unit_id" => "m6u1a", "unit_title" => "Expressions and Equations", "description" => "

Students analyze variable relationships.

",