Fix external_id auto-generation: keep acronyms together (e.g. dns_cloudflare not d_n_s_cloudflare)#95
Merged
scottgrayson merged 5 commits into4.xfrom Feb 19, 2026
Merged
Conversation
… stay together Str::snake() was splitting acronyms (e.g. DNS Cloudflare Training -> d_n_s_cloudflare_training). Use Str::slug($state, '_') so we get dns_cloudflare_training for external integrations like HubSpot. - CourseResource: afterStateUpdated on name now sets external_id via Str::slug(..., '_') - CourseFactory: use Str::slug($name, '_') for external_id in tests Co-authored-by: Cursor <cursoragent@cursor.com>
- reportUsesSingleNameColumn() helper in CourseProgressQueryService - Reporting page: one 'Name' column when report_user_name_columns is ['name'], else First/Last - CourseProgressExport: dynamic headings and map to match Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
… to avoid duplicated logic Co-authored-by: Cursor <cursoragent@cursor.com>
- BackfillCourseCompletedAt command: finds users who completed all steps from lms_step_user, inserts/updates lms_course_user with completed_at = max step date - Migration stub runs filament-lms:backfill-course-completed-at on deploy - Register command and migration in FilamentLmsServiceProvider - Course model: steps() select/order fix for ambiguous id Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Auto-generated course
external_id(from the name field on create/edit) was usingStr::snake(), which inserts underscores before every uppercase letter. That turned names like "DNS Cloudflare Training" intod_n_s_cloudflare_traininginstead ofdns_cloudflare_training, breaking external integrations (e.g. HubSpot property keys).Changes
external_idwithStr::slug($state, '_')instead ofStr::snake($state), so acronyms stay as one token (e.g.dns_cloudflare_training).Str::slug($name, '_')forexternal_idin tests for consistency.Testing
dns_cloudflare_training.d_n_s_...in DB are unchanged; they can be edited and re-derived from the name or updated manually if needed.Made with Cursor
Note
Medium Risk
Includes a data backfill that inserts/updates
lms_course_userrows via a migration and could affect completion reporting if run on large datasets or with unexpected course/test configurations.Overview
Fixes course
external_idauto-generation to keep acronyms intact by switching fromStr::snake()to underscore-basedStr::slug()in bothCourseResourceandCourseFactory.Adds a new backfill migration plus
filament-lms:backfill-course-completed-atcommand to populatelms_course_user.completed_atfrom the latest per-step completion timestamp (respectingrequired_test_percentage), and registers both in the service provider.Updates course progress reporting/export to dynamically show either a single Name column or First Name/Last Name based on config, and adjusts
Course::steps()to explicitlyselect('lms_steps.*')to avoid column ambiguity in joins.Written by Cursor Bugbot for commit c970c9c. This will update automatically on new commits. Configure here.