-
Notifications
You must be signed in to change notification settings - Fork 524
Clean up references to Courses 1-4 and 20-hour/Accelerated #69991
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
Clean up references to Courses 1-4 and 20-hour/Accelerated #69991
Conversation
73a69c7 to
8b7c6e9
Compare
dashboard/test/controllers/certificate_images_controller_test.rb
Outdated
Show resolved
Hide resolved
| assert_redirected_to "/s/#{new_unit.name}" | ||
| end | ||
|
|
||
| test "should render deprecated course page for deprecated courses" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It turned out there wasn't a unit test confirming the deprecated course error page actually works, so I added one.
This commit removes references to the deprecated curricula: course1, course2, course3, course4, and 20-hour (also known as "accelerated"). Changes include: - Remove course constants and categories from ScriptConstants - Remove course recommendation mappings for deprecated courses - Remove certificate logic for 20-hour/accelerated courses - Remove course block helpers for deprecated courses - Remove deprecated unit helper methods (course1_unit, twenty_hour_unit) - Remove legacy course validation logic - Remove deprecated course cards from certificate flow - Remove legacy course components from CourseBlocks UI - Simplify CourseBlocksIntl to always show modern courses Note: Config files, i18n files, and deprecated_course view remain for backward compatibility until final removal in September 2025. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update tests to remove references to deprecated courses: - Remove course1-4 and accelerated mappings from csf_next_course_recommendation test - Remove course1/course2 banner image assertions - Remove course4 from tracking pixel and HOC finish URL tests - Remove entire test for 20-hour script routing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The csf_international category was removed as it only contained deprecated courses (course1-4). This removes: - csf_international? method definition - has_banner? check for csf_international courses - View conditional for csf_international courses 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace remaining references to removed twenty_hour_unit method with hoc_2014_unit in controller tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed course2, course3, and course4 from the test since these courses were deprecated and their cards were removed from the codebase. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixed remaining references to the deprecated twenty_hour_unit method: - Updated header fallback script - Updated API controller fallback - Updated test references in script_level_test and api_controller_test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed test to create a unit with known structure instead of relying on hoc_2014_unit, which has a different structure than the deprecated twenty_hour_unit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Removed tests for 20-hour and accelerated courses - Removed tests for course1-4 - Updated tests to use coursea-2025 as example CSF course - Updated setup to create coursea-2025 instead of deprecated courses - All tests passing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Removed empty if block that was causing 500 errors when viewing course unit overview pages. Also updated db_query_test to reflect correct query count after fixing the view syntax error.
These constants (COURSE1_NAME, COURSE2_NAME, COURSE3_NAME, COURSE4_NAME, TWENTY_HOUR_NAME) are still needed by the deprecated_course.html.haml view to display appropriate messages when users visit deprecated courses. Added them back as standalone constants with a comment explaining they're kept for the deprecated course page rendering.
Tests that when a course is marked as deprecated, the scripts controller renders the deprecated_course error page with the correct curriculum name.
1f2fdf6 to
23273e1
Compare
davidsbailey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Excited to see us further deprecate things! I think you can remove the skipped test.
| test 'user should prefer working on 20hour instead of hoc' do | ||
| # TODO figure out if we still need this test | ||
| skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test looks safe to remove to me because it is validating behavior that we don't actually want and probably don't care if it breaks.
this test is just validating the sort order of the results of working_on_units, which mostly comes from here:
code-dot-org/dashboard/app/models/user.rb
Line 291 in 8779a26
| has_many :user_scripts, -> {order Arel.sql("-completed_at asc, greatest(coalesce(started_at, 0), coalesce(assigned_at, 0), coalesce(last_progress_at, 0)) desc, user_scripts.id asc")} |
strangely, the behavior it is validating is that when there is no timestamp field to sort by (most recent first), we fall back to id, showing LEAST recent first.
We usually do set a timestamp when we create a UserScript object, but in the case where we don't (such as here) I can't imagine it being important that the less-recent entry shows up first -- more likely we just need the id field to make sure that there is a deterministic sort order of some kind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! And thanks for catching - I was planning on returning to this test but obviously missed it 🙈
Now that Courses 1-4 and 20-hour (also known as accelerated) have been deprecated for a couple months, this PR removes some of the extra business logic we had for those courses.
This PR was generated largely by Claude Code, with a human (me) in the loop, to more quickly find and remove references to these courses. I'm mostly relying on test coverage to ensure no unintended breakages.