Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTL (Test > Levelbuilder): 65d55a86 #41610

Merged
merged 13 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions bin/cron/csf_workshop_attendance_to_gdrive
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ def get_rows
"Total Hours",
"Num Registered",
"Number Scholarship Teachers Attending All Sessions",
"Attendance Day 1+"
"Attendance Day 1+",
"Workshop End Date"
]
]

Expand All @@ -54,7 +55,8 @@ def get_rows
workshop.effective_num_hours,
workshop.enrollments.count,
workshop.teachers_attending_all_sessions(true).count,
workshop.teachers_attending_all_sessions.count
workshop.teachers_attending_all_sessions.count,
workshop.sessions.last&.formatted_date
]
end

Expand Down
1 change: 1 addition & 0 deletions dashboard/app/models/levels/level.rb
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ def clone_with_name(new_name, editor_experiment: nil)
# specify :published to make should_write_custom_level_file? return true
level_params = {name: new_name, parent_level_id: id, published: true}
level_params[:editor_experiment] = editor_experiment if editor_experiment
level_params[:audit_log] = [{changed_at: Time.now, changed: ["cloned from #{name.dump}"], cloned_from: name}].to_json
level.update!(level_params)
level
end
Expand Down
8 changes: 5 additions & 3 deletions dashboard/lib/services/script_seed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ def self.serialize_seeding_json(script)
resources = script.lessons.map(&:resources).flatten.concat(script.resources).concat(script.student_resources).uniq.sort_by(&:key)

# Use the existing seeding_key code to efficiently sort LessonsResource
# objects in a manner that will be stable across environments.
# and ScriptsResource objects in a manner that will be stable across environments.
lr_seed_context = SeedContext.new(lessons: script.lessons, resources: resources)
lessons_resources = script.lessons.map(&:lessons_resources).flatten.sort_by {|lr| lr.seeding_key(lr_seed_context).to_json}
sr_seed_context = SeedContext.new(script: script, resources: resources)
scripts_resources = script.scripts_resources.sort_by {|sr| sr.seeding_key(sr_seed_context).to_json}

vocabularies = script.lessons.map(&:vocabularies).flatten
lessons_vocabularies = script.lessons.map(&:lessons_vocabularies).flatten
Expand All @@ -70,7 +72,7 @@ def self.serialize_seeding_json(script)
levels: my_levels,
resources: resources,
lessons_resources: lessons_resources,
scripts_resources: script.scripts_resources,
scripts_resources: scripts_resources,
scripts_student_resources: script.scripts_student_resources,
vocabularies: vocabularies,
lessons_vocabularies: lessons_vocabularies,
Expand All @@ -95,7 +97,7 @@ def self.serialize_seeding_json(script)
levels_script_levels: script.levels_script_levels.map {|lsl| ScriptSeed::LevelsScriptLevelSerializer.new(lsl, scope: scope).as_json},
resources: resources.map {|r| ScriptSeed::ResourceSerializer.new(r, scope: scope).as_json},
lessons_resources: lessons_resources.map {|lr| ScriptSeed::LessonsResourceSerializer.new(lr, scope: scope).as_json},
scripts_resources: script.scripts_resources.map {|sr| ScriptSeed::ScriptsResourceSerializer.new(sr, scope: scope).as_json},
scripts_resources: scripts_resources.map {|sr| ScriptSeed::ScriptsResourceSerializer.new(sr, scope: scope).as_json},
scripts_student_resources: script.scripts_student_resources.map {|sr| ScriptSeed::ScriptsResourceSerializer.new(sr, scope: scope).as_json},
vocabularies: vocabularies.map {|v| ScriptSeed::VocabularySerializer.new(v, scope: scope).as_json},
lessons_vocabularies: lessons_vocabularies.map {|lv| ScriptSeed::LessonsVocabularySerializer.new(lv, scope: scope).as_json},
Expand Down