Add ExCS projects - #982
Conversation
Test coverage93.5% line coverage reported by SimpleCov. |
There was a problem hiding this comment.
Pull request overview
Enables teachers to create lessons by remixing from a shared Experience CS “code editor scratch” project (via a new lesson[source_project_identifier] param), and centralizes project-copying/media-copying logic into a reusable Project::Copying helper under lib/concepts.
Changes:
- Add
lesson[source_project_identifier]handling inPOST /api/lessons, including loading viaProjectLoader, authorization, and Scratch gating based on the resolved source project. - Update
Lesson::Createto optionally build the lesson’s project by copying from a source project (including media), rather than always creating a stub. - Refactor media/component/scratch-component copying into
Project::Copyingand reuse it from lesson/project operations.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| spec/features/lesson/creating_a_lesson_spec.rb | Adds feature coverage for creating lessons from an ExCS source project and Scratch gating behavior. |
| spec/concepts/lesson/create_spec.rb | Adds unit coverage for Lesson::Create when a source project is provided (locale selection, instructions/content copying, etc.). |
| lib/concepts/project/operations/create_remix.rb | Replaces inline media-copy loops with Project::Copying.copy_media. |
| lib/concepts/project/copying.rb | Introduces shared copying utilities for projects, components, scratch component, and media attachments. |
| lib/concepts/lesson/operations/create.rb | Adds optional source_project: flow to build the lesson project from a copy/remix-like template. |
| lib/concepts/lesson/operations/create_copy.rb | Refactors lesson-copy project duplication to use Project::Copying.copy_project. |
| app/controllers/concerns/lesson_creation.rb | Extends Scratch enablement gate to consider the resolved source_project. |
| app/controllers/api/lessons_controller.rb | Adds source_project_identifier handling, loads/validates the source project, authorizes it, and passes it into Lesson::Create. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| def remix_attributes(source_project, project_params) | ||
| { | ||
| locale: nil, | ||
| name: project_params[:name].presence || source_project.name, | ||
| user_id: project_params[:user_id], | ||
| school_id: project_params[:school_id], | ||
| lesson_id: project_params[:lesson_id] | ||
| } | ||
| end |
There was a problem hiding this comment.
This will be worked on a separate issue as this is not as simple as just adding those attributes and more thoughts are required in terms of teacher project logic and ability.
Status
What's changed?
Follow-ups (not in this PR)
remixed_from_idis used to track the source project or, use another field for it.