From c0143c326a8c254aecfa106dccca00b0f774b466 Mon Sep 17 00:00:00 2001 From: mpaulosky <60372079+mpaulosky@users.noreply.github.com> Date: Tue, 29 Sep 2026 16:56:14 -0700 Subject: [PATCH 1/2] fix(UI): Name the Statuses as CONTEXT.md does The glossary names the Statuses Accepted, Watching, Upcoming and Dismissed, but the code used three different sets. The seeder created Answered, Watching, Upcoming and Dismissed, while the Set Status buttons, the status styles, FakeStatus and Enums.Status used Answered, InWork, Watching and Dismissed. On a seeded database the "in work" button looked up a Status that didn't exist and threw. Everything now uses Accepted, Watching, Upcoming and Dismissed, including the button ids and CSS classes. The seeded descriptions and the Create page say "issue" instead of "suggestion". scripts/migrations/152-rename-answered-status.js renames existing Answered records, including each Issue's copy of its Status, and rewords seeded descriptions. It can safely be run more than once. Refs #152 Co-Authored-By: Claude Opus 5.5 --- .../migrations/152-rename-answered-status.js | 34 +++++++++++++++++++ .../BogusFakes/FakeStatus.cs | 6 ++-- .../IssueTracker.CoreBusiness/Enum/Enums.cs | 6 ++-- .../Components/IssueComponent.razor.cs | 4 +-- .../Components/IssueComponent.razor.css | 4 +-- .../Components/SetStatusComponent.razor | 12 +++---- .../Components/SetStatusComponent.razor.cs | 4 +-- .../Components/SetStatusComponent.razor.css | 4 +-- src/UI/IssueTracker.UI/Pages/Create.razor | 2 +- .../IssueTracker.UI/Pages/SampleData.razor.cs | 10 +++--- src/UI/IssueTracker.UI/wwwroot/css/site.css | 8 ++--- .../Components/IssueComponentTests.cs | 8 ++--- .../Components/SetStatusComponentTests.cs | 12 +++---- .../Pages/CommentTests.cs | 4 +-- .../Pages/CreateTests.cs | 2 +- .../Pages/DetailsTests.cs | 24 ++++++------- .../Pages/IndexTests.cs | 4 +-- .../Pages/StatusesTests.cs | 24 ++++++------- 18 files changed, 103 insertions(+), 69 deletions(-) create mode 100644 scripts/migrations/152-rename-answered-status.js diff --git a/scripts/migrations/152-rename-answered-status.js b/scripts/migrations/152-rename-answered-status.js new file mode 100644 index 00000000..96ae203a --- /dev/null +++ b/scripts/migrations/152-rename-answered-status.js @@ -0,0 +1,34 @@ +// One-off data migration for #152: rename the "Answered" Status to "Accepted" (CONTEXT.md) and replace +// "suggestion" with "issue" in the seeded Status descriptions. Issues keep their own copy of their Status +// (IssueStatus), so those copies are updated too. Safe to run more than once. +// +// Run it with mongosh against the app's database, for example: +// mongosh "mongodb://localhost:27017/devissuetracker?authSource=admin" scripts/migrations/152-rename-answered-status.js + +const descriptions = { + Accepted: "The issue was accepted and the corresponding item was created.", + Watching: "The issue is interesting. We are watching to see how much interest there is in it.", + Upcoming: "The issue was accepted and it will be released soon.", + Dismissed: "The issue was not something that we are going to undertake." +}; + +const renamed = db.statuses.updateMany( + { status_name: "Answered" }, + { $set: { status_name: "Accepted" } }); +print(`statuses renamed Answered -> Accepted: ${renamed.modifiedCount}`); + +const renamedCopies = db.issues.updateMany( + { "IssueStatus.StatusName": "Answered" }, + { $set: { "IssueStatus.StatusName": "Accepted" } }); +print(`issue Status copies renamed Answered -> Accepted: ${renamedCopies.modifiedCount}`); + +// Only descriptions still worded with "suggestion" are replaced, so an Admin's own wording is kept. +for (const [name, description] of Object.entries(descriptions)) { + const statuses = db.statuses.updateMany( + { status_name: name, status_description: /suggestion/ }, + { $set: { status_description: description } }); + const copies = db.issues.updateMany( + { "IssueStatus.StatusName": name, "IssueStatus.StatusDescription": /suggestion/ }, + { $set: { "IssueStatus.StatusDescription": description } }); + print(`${name} descriptions updated: ${statuses.modifiedCount} statuses, ${copies.modifiedCount} issue copies`); +} diff --git a/src/CoreBusiness/IssueTracker.CoreBusiness/BogusFakes/FakeStatus.cs b/src/CoreBusiness/IssueTracker.CoreBusiness/BogusFakes/FakeStatus.cs index 96f0f6d0..52ee1cdc 100644 --- a/src/CoreBusiness/IssueTracker.CoreBusiness/BogusFakes/FakeStatus.cs +++ b/src/CoreBusiness/IssueTracker.CoreBusiness/BogusFakes/FakeStatus.cs @@ -45,7 +45,7 @@ public static List GetStatuses() new StatusModel { Id = new BsonObjectId(ObjectId.GenerateNewId()).ToString(), - StatusName = "Answered", + StatusName = "Accepted", StatusDescription = "The issue was accepted and the corresponding item was created.", Archived = false }, @@ -60,8 +60,8 @@ public static List GetStatuses() new StatusModel { Id = new BsonObjectId(ObjectId.GenerateNewId()).ToString(), - StatusName = "InWork", - StatusDescription = "The issue was accepted and it is in work.", + StatusName = "Upcoming", + StatusDescription = "The issue was accepted and it will be released soon.", Archived = false }, new StatusModel diff --git a/src/CoreBusiness/IssueTracker.CoreBusiness/Enum/Enums.cs b/src/CoreBusiness/IssueTracker.CoreBusiness/Enum/Enums.cs index 2ad54296..5519e1f2 100644 --- a/src/CoreBusiness/IssueTracker.CoreBusiness/Enum/Enums.cs +++ b/src/CoreBusiness/IssueTracker.CoreBusiness/Enum/Enums.cs @@ -24,13 +24,13 @@ internal enum Category } /// - /// Status enum + /// Status enum: the Status names an Admin can give an approved Issue, as named in CONTEXT.md /// internal enum Status { - Answered, + Accepted, Watching, Dismissed, - InWork + Upcoming } } \ No newline at end of file diff --git a/src/UI/IssueTracker.UI/Components/IssueComponent.razor.cs b/src/UI/IssueTracker.UI/Components/IssueComponent.razor.cs index a3f6ed50..a70c9a8e 100644 --- a/src/UI/IssueTracker.UI/Components/IssueComponent.razor.cs +++ b/src/UI/IssueTracker.UI/Components/IssueComponent.razor.cs @@ -46,8 +46,8 @@ private static string GetIssueStatusCssClass(IssueModel issue) { string output = issue.IssueStatus.StatusName switch { - "Answered" => "issue-entry-status-answered", - "InWork" => "issue-entry-status-inwork", + "Accepted" => "issue-entry-status-accepted", + "Upcoming" => "issue-entry-status-upcoming", "Watching" => "issue-entry-status-watching", "Dismissed" => "issue-entry-status-dismissed", _ => "issue-entry-status-none" diff --git a/src/UI/IssueTracker.UI/Components/IssueComponent.razor.css b/src/UI/IssueTracker.UI/Components/IssueComponent.razor.css index 5f74f825..c13e4770 100644 --- a/src/UI/IssueTracker.UI/Components/IssueComponent.razor.css +++ b/src/UI/IssueTracker.UI/Components/IssueComponent.razor.css @@ -94,7 +94,7 @@ letter-spacing: 1.2px; } -.issue-entry-status-answered { +.issue-entry-status-accepted { background-color: #b5d43a; border: 1px #b5d43a solid; } @@ -104,7 +104,7 @@ border: 1px solid #e9354c; } -.issue-entry-status-inwork { +.issue-entry-status-upcoming { background-color: #fd7e14; border: 1px solid #fd7e14; } diff --git a/src/UI/IssueTracker.UI/Components/SetStatusComponent.razor b/src/UI/IssueTracker.UI/Components/SetStatusComponent.razor index 6df31970..9eacef37 100644 --- a/src/UI/IssueTracker.UI/Components/SetStatusComponent.razor +++ b/src/UI/IssueTracker.UI/Components/SetStatusComponent.razor @@ -10,13 +10,13 @@ @if (string.IsNullOrWhiteSpace(_settingStatus)) { - - - - - -