fix: resolve 4 QA bugs found in Docker production build

- fix(member-management): Zod v4 .partial() on refined schema crash
  Separated CreateMemberBaseSchema from superRefine so .partial()
  works for UpdateMemberSchema. Fixes members-cms page crash.

- fix(course-management): snake_case→camelCase stats normalization
  getQuickStats RPC returns snake_case keys but templates expect
  camelCase. Added normalization layer so stats cards display values.

- fix(blog): add missing cover images for 5 German blog posts
  Posts referenced /images/posts/*.webp that didn't exist.

- fix(docker): remove non-existent catch_entries table from bootstrap
  dev-bootstrap.sh granted permissions on catch_entries which has no
  migration. Removed the stale reference.

- docs: add qa-checklist.md with full test report
This commit is contained in:
Zaid Marzguioui
2026-04-03 18:41:51 +02:00
parent 4d538a5668
commit 5b169a381f
9 changed files with 261 additions and 107 deletions

View File

@@ -13,21 +13,31 @@ export function createCourseStatisticsService(
{ p_account_id: accountId },
);
if (error) throw error;
// RPC returns a single row as an array
const stats = Array.isArray(data) ? data[0] : data;
return (
stats ?? {
total_courses: 0,
open_courses: 0,
running_courses: 0,
completed_courses: 0,
cancelled_courses: 0,
total_participants: 0,
total_waitlisted: 0,
avg_occupancy_rate: 0,
total_revenue: 0,
}
);
// RPC returns a single row as an array with snake_case keys
const raw = Array.isArray(data) ? data[0] : data;
const s = raw ?? {
total_courses: 0,
open_courses: 0,
running_courses: 0,
completed_courses: 0,
cancelled_courses: 0,
total_participants: 0,
total_waitlisted: 0,
avg_occupancy_rate: 0,
total_revenue: 0,
};
// Normalise to camelCase for consumers
return {
totalCourses: s.total_courses ?? s.totalCourses ?? 0,
openCourses: s.open_courses ?? s.openCourses ?? 0,
runningCourses: s.running_courses ?? s.runningCourses ?? 0,
completedCourses: s.completed_courses ?? s.completedCourses ?? 0,
cancelledCourses: s.cancelled_courses ?? s.cancelledCourses ?? 0,
totalParticipants: s.total_participants ?? s.totalParticipants ?? 0,
totalWaitlisted: s.total_waitlisted ?? s.totalWaitlisted ?? 0,
avgOccupancyRate: s.avg_occupancy_rate ?? s.avgOccupancyRate ?? 0,
totalRevenue: s.total_revenue ?? s.totalRevenue ?? 0,
};
},
async getAttendanceSummary(courseId: string) {