feat(training): Add edit functionality for training module#319
feat(training): Add edit functionality for training module#319waylonkenning wants to merge 102 commits intoResgrid:developfrom
Conversation
CU-3wen6jw fixing worker issue
CU-3wen6jw adding permission checks for users
CU-868a1kgf7 update for android push
CU-868a1kgf7 fixing iOS critical notification bug.
CU-868a3neq0 trying to fix eventing issue.
CU-868a5nz1n fixed wrong url for messages email
CU-868a5nz1n setting new default for error logger (console)
CU-868a5nz1n trying to fix pricing page.
CU-868a7khdq making subscription page a bit more clear.
CU-868a7khdq Changing how stripeCustomerId empty are handled
CU-868a7khdq trying to fix sub bug
CU-868ba84kp fixing bug with db container reg
CU-8687aj3gt Adjusting angular build
CU-8687aj3gt Working on Novu api call provider
CU-8687aj3gt Working on more Novu push work
CU-3w8z67w Fixing docker paths
CU-3w8z67w Working on lib issue.
CU-868d85dv8 Fixed missing connection string issues.
CU-868d85dv8 Fixing docker typo
CU-868d85dv8 More upgrade work and posthog work.
CU-868d85dv8 fixed url shortner to use kutt
RE1-T102 Working on build.
RE1-T102 Moving MCP config to normal Resgrid.Confg structure.
RE1-T102 Added healthcheck
RE1-T102 Fixing MCP server issue.
RE1-T102 MCP server over HTTP fix
RE1-T100 Fixing tests
RE1-T60 Updated to SCIM and SSO flow
RE1-T46 Fixing bug with action logs query.
RE1-T46 bug fixes
RE1-T46 Bug fixes
RE1-T46 Flagged report, select unit and report bug fix.
RE1-T46 Trying to fix Sentry issue
RE1-T106 Notification page fix
RE1-T105 More custom maps work
RE1-T105 Fixing map issue
RE1-T105 Map fixes
RE1-T105 Fixing issues with routes.
RE1-T105 Added Languages to missing pages, gdpr support for export, e…
RE1-T107 Added checkin timers to calls
…all/Station The commit RE1-T104 switched from Kendo UI Windows to Bootstrap modals but didn't add the required modal HTML structure. Kendo's kendoWindow() could auto-create the window on empty divs, but Bootstrap modals require actual HTML with .modal, .modal-dialog, .modal-content classes. This fix adds proper Bootstrap modal HTML for both respondToACallWindow and respondToAStationWindow modals in Dashboard.cshtml. Fixes Resgrid#317
Add ability for department admins to edit existing trainings: - Add Edit GET/POST actions to TrainingsController - Create EditTrainingModel view model - Create Edit.cshtml view with form for editing training details - Add Edit button to training index page (admin only) - Preserve existing attachments, questions, and user assignments - Support adding new attachments, users, groups, and roles - Add comprehensive unit tests for TrainingService Files added: - Tests/Resgrid.Tests/Mocks/MockTrainingRepository.cs - Tests/Resgrid.Tests/Mocks/MockTrainingAttachmentRepository.cs - Tests/Resgrid.Tests/Mocks/MockTrainingQuestionRepository.cs - Tests/Resgrid.Tests/Mocks/MockTrainingUserRepository.cs - Tests/Resgrid.Tests/Services/TrainingServiceTests.cs - Web/Resgrid.Web/Areas/User/Models/Training/EditTrainingModel.cs - Web/Resgrid.Web/Areas/User/Views/Trainings/Edit.cshtml - Web/Resgrid.Web/wwwroot/js/app/internal/training/resgrid.training.edittraining.js Files modified: - Web/Resgrid.Web/Areas/User/Controllers/TrainingsController.cs - Web/Resgrid.Web/Areas/User/Views/Trainings/Index.cshtml
|
Thanks for opening this pull request! A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| 27318226 | Triggered | Generic Password | f509d38 | Tests/Resgrid.Tests/Web/Mcp/SensitiveDataRedactorTests.cs | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
Summary
This PR implements editable training articles as requested in #180, allowing department admins to modify training content after creation.
Fixes #180
Changes
New Features
Files Added
Tests/Resgrid.Tests/Mocks/MockTrainingRepository.cs- In-memory repository for unit testsTests/Resgrid.Tests/Mocks/MockTrainingAttachmentRepository.cs- Mock for attachment queriesTests/Resgrid.Tests/Mocks/MockTrainingQuestionRepository.cs- Mock for question queriesTests/Resgrid.Tests/Mocks/MockTrainingUserRepository.cs- Mock for user assignment queriesTests/Resgrid.Tests/Services/TrainingServiceTests.cs- 15 unit tests for service layerWeb/Resgrid.Web/Areas/User/Models/Training/EditTrainingModel.cs- View modelWeb/Resgrid.Web/Areas/User/Views/Trainings/Edit.cshtml- Edit form viewWeb/Resgrid.Web/wwwroot/js/app/internal/training/resgrid.training.edittraining.js- JavaScript for edit pageFiles Modified
Web/Resgrid.Web/Areas/User/Controllers/TrainingsController.cs- Added Edit GET/POST actionsWeb/Resgrid.Web/Areas/User/Views/Trainings/Index.cshtml- Added Edit button for adminsIssue Requirements Addressed
From #180:
Future Enhancements (Not in this PR)
Testing
Unit Tests (15 tests)
GetTrainingByIdAsync- Returns training with questions/attachmentsGetAllTrainingsForDepartmentAsync- Filters by departmentSaveAsync- Create/update with questions, HTML sanitizationDeleteTrainingAsync- Removes trainingSetTrainingAsViewedAsync- Marks viewed, auto-completes when no questionsRecordTrainingQuizResultAsync- Records score and completionResetUserAsync- Resets user progressGetTrainingUsersForUserAsync- Gets user's assigned trainingsManual Testing Checklist
Screenshots
Edit button added to training index page next to Report and Delete buttons for department admins
Edit form pre-populates all existing training data including attachments, questions, and user assignments