From d787a3e8decab136cecf3166faddff71efd770d3 Mon Sep 17 00:00:00 2001 From: Duncan MacKenzie Date: Tue, 14 Jan 2025 09:41:05 -0800 Subject: [PATCH] CMS-613: Filter empty notes out of /seasons payload (#81) --- backend/routes/api/seasons.js | 7 +++++++ frontend/src/components/ChangeLogsList.jsx | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/routes/api/seasons.js b/backend/routes/api/seasons.js index 3c28987..106e650 100644 --- a/backend/routes/api/seasons.js +++ b/backend/routes/api/seasons.js @@ -55,6 +55,13 @@ router.get( model: SeasonChangeLog, as: "changeLogs", attributes: ["id", "notes", "createdAt"], + // Filter out empty notes + where: { + notes: { + [Op.ne]: "", + }, + }, + required: false, order: [["createdAt", "DESC"]], include: [ { diff --git a/frontend/src/components/ChangeLogsList.jsx b/frontend/src/components/ChangeLogsList.jsx index d255cad..e539ca1 100644 --- a/frontend/src/components/ChangeLogsList.jsx +++ b/frontend/src/components/ChangeLogsList.jsx @@ -16,7 +16,6 @@ export default function ChangeLogsList({ changeLogs = [] }) { )} - {changeLog.notes ? "" : "Submitted "} {formatDate(changeLog.createdAt, "America/Vancouver")} by{" "} {changeLog.user.name}