Skip to content

Fix grower save bug, add name sorting, and clarify status meanings#164

Open
markdav-is wants to merge 1 commit into
mainfrom
claude/magical-bardeen-6xoprw
Open

Fix grower save bug, add name sorting, and clarify status meanings#164
markdav-is wants to merge 1 commit into
mainfrom
claude/magical-bardeen-6xoprw

Conversation

@markdav-is

Copy link
Copy Markdown
Member

Summary

  • Fixes Bug: Grower Edit page fails to save — 'Unable to save changes. Please try again.' #155 — Grower Edit page save was silently failing for users without explicit "Edit" module permission. The service layer was doing its own IsAuthorized check (against CLAUDE.md policy), returning null when it failed, which surfaced as "Unable to save changes. Please try again." Removed the service-layer check and aligned the PUT /{id} controller endpoint to use [Authorize(Policy = PolicyNames.EditModule)], matching the existing POST endpoint.

  • Fixes sortable columns for growers. #161 — Grower list had no consistent ordering. All repository list methods (GetAllGrowers, GetActiveGrowers, GetGrowersByStatus, GetGrowersByVillage, GetGrowersByMentor) now sort by GrowerName alphabetically. Note: since the name is a single field, this sorts by full name — a separate Surname column would be needed for true surname-first sorting.

  • Fixes Support: Team unclear on what 'Inactive' grower status means #149 — Status badges in Grower Index and Edit now include a title tooltip explaining what each status means on hover: Active (currently participating), Inactive (temporarily paused, still in program), Exited (permanently left).

Test plan

  • Edit an existing grower record and click Save — confirm it succeeds without "Unable to save changes" error
  • Add a new grower — confirm it saves and redirects to the Edit page
  • Open the Grower list — confirm growers are sorted alphabetically by name
  • Apply a village or status filter — confirm filtered list is also sorted
  • Hover a status badge in the Grower list — confirm tooltip text appears
  • Hover a status badge in Grower Edit — confirm tooltip text appears

https://claude.ai/code/session_013s3rc5YSBFQ5U9Ef1bH13c


Generated by Claude Code

- #155: Remove service-layer permission check from UpdateGrowerAsync and
  align the PUT controller endpoint to use EditModule policy (matching
  the POST). The extra IsAuthorized call in the service returned null
  for users without explicit module Edit permission, producing the
  'Unable to save changes' error.

- #161: Add ORDER BY GrowerName to all grower list queries in the
  repository so the list is consistently alphabetical across filters.

- #149: Add tooltip (title attribute) to status badges in Grower Index
  and Edit pages explaining the difference between Active, Inactive,
  and Exited so users understand what each status means on hover.

https://claude.ai/code/session_013s3rc5YSBFQ5U9Ef1bH13c
Copilot AI review requested due to automatic review settings June 8, 2026 23:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Grower module reliability and usability by fixing an authorization-related save failure, enforcing consistent alphabetical ordering of grower lists, and clarifying grower status meanings via UI tooltips.

Changes:

  • Removed service-layer authorization gating for grower updates and enforced edit authorization at the PUT controller endpoint.
  • Added OrderBy(g => g.GrowerName) to grower list repository methods to ensure consistent sorting.
  • Added status “meaning” tooltips to Grower Index and Edit status badges.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Server/Services/GrowerService.cs Removes service-layer authorization check from update path to avoid silent save failures.
Server/Repository/GrowerRepository.cs Applies consistent alphabetical ordering by GrowerName across list queries.
Server/Controllers/GrowerController.cs Tightens PUT authorization to require EditModule policy (matching POST).
Client/Modules/Grower/Index.razor Adds status tooltip descriptions for list badges (with noted localization/accessibility follow-ups).
Client/Modules/Grower/Edit.razor Adds status tooltip/ARIA label on edit badge and includes a small formatting fix opportunity.

Comment on lines +126 to 129
<span class="badge @GetStatusBadgeClass(grower.Status)"
title="@GetStatusDescription(grower.Status)">
@GetStatusText(grower.Status)
</span>
Comment on lines +346 to +352
private string GetStatusDescription(GrowerStatus status) => status switch
{
GrowerStatus.Active => "Currently participating in the program.",
GrowerStatus.Inactive => "Temporarily paused (e.g. illness or travel) but has not left the program.",
GrowerStatus.Exited => "Has permanently left the program.",
_ => string.Empty
};
<span class="badge bg-secondary me-1">General</span>
}
<small class="text-muted">@note.CreatedOn.ToLocalTime().ToString("yyyy-MM-dd HH:mm") � @note.CreatedBy</small>
<small class="text-muted">@note.CreatedOn.ToLocalTime().ToString("yyyy-MM-dd HH:mm") � @note.CreatedBy</small>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants