summaryrefslogtreecommitdiff
path: root/Omni/Task
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-27 10:04:35 -0500
committerBen Sima <ben@bensima.com>2025-11-27 10:04:35 -0500
commitfa64226855f63bafad9cf0a59baef200030eabed (patch)
tree955796125f718c2ab2182068dc226f5fbd60e901 /Omni/Task
parentdbe2b82d2f53761d9504fb4e5cf37f64a2000b7a (diff)
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
Diffstat (limited to 'Omni/Task')
-rw-r--r--Omni/Task/Core.hs18
1 files changed, 7 insertions, 11 deletions
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]