From 3d828feba67f21ae62d1e6eb598a22ffaebf1174 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 15 Mar 2017 21:39:15 +0100 Subject: Better ids & warnings --- Handler/InventoryListing.hs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Handler/InventoryListing.hs') diff --git a/Handler/InventoryListing.hs b/Handler/InventoryListing.hs index d5252a1..d87512a 100644 --- a/Handler/InventoryListing.hs +++ b/Handler/InventoryListing.hs @@ -12,7 +12,20 @@ postInventoryListingR = do FormSuccess (Item{..} `WithType` t) -> runDB $ do upsertBy (UniqueKind itemNormKind) (Kind itemNormKind t) [ KindType =. t ] newItem <- insert Item{..} - addMessage "insertSuccess" [hamlet|Inserted new item as #{humanId newItem}|] + otherItems <- selectKeysList [ ItemNormKind ==. itemNormKind, ItemId !=. newItem ] [] + when (not $ null otherItems) . addMessage "insertAmbiguous" $ + [shamlet| + $newline never + There are other items of the same kind. +