From fa64226855f63bafad9cf0a59baef200030eabed Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 27 Nov 2025 10:04:35 -0500 Subject: Fix filter dropdowns returning empty string for All option The build passes. The fix I implemented: 1. **Changed the API type** in `Omni/Jr/Web.hs` to use `QueryParam "stat 2. **Added manual parsing** in `taskListHandler` with `parseStatus` and 3. **Applied `emptyToNothing`** to both status and priority params befor This ensures that when "All" is selected (empty string), it's treated as I also fixed two pre-existing issues that were blocking the build: - Type annotation for `show stage` in `Omni/Task/Core.hs` - `AesonKey.fromText` conversion in `Omni/Agent/Worker.hs` Task-Id: t-149.1 --- Omni/Task/Core.hs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'Omni/Task/Core.hs') diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index bd70fde..4e65581 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -140,18 +140,14 @@ instance FromJSON TaskActivity -- HTTP API Instances (for Servant query params) instance FromHttpApiData Status where - parseQueryParam t - | T.null t = Left "" - | otherwise = case readMaybe (T.unpack t) of - Just s -> Right s - Nothing -> Left ("Invalid status: " <> t) + parseQueryParam t = case readMaybe (T.unpack t) of + Just s -> Right s + Nothing -> Left ("Invalid status: " <> t) instance FromHttpApiData Priority where - parseQueryParam t - | T.null t = Left "" - | otherwise = case readMaybe (T.unpack t) of - Just p -> Right p - Nothing -> Left ("Invalid priority: " <> t) + parseQueryParam t = case readMaybe (T.unpack t) of + Just p -> Right p + Nothing -> Left ("Invalid priority: " <> t) -- SQLite Instances @@ -1013,7 +1009,7 @@ logActivity tid stage metadata = SQL.execute conn "INSERT INTO task_activity (task_id, stage, message, metadata) VALUES (?, ?, ?, ?)" - (tid, show stage, Nothing :: Maybe Text, metadata) + (tid, show stage :: String, Nothing :: Maybe Text, metadata) -- | Get all activities for a task, ordered by timestamp descending getActivitiesForTask :: Text -> IO [TaskActivity] -- cgit v1.2.3