priority inversion, 0 is always first

This commit is contained in:
Keagan McClelland
2022-03-01 16:08:30 -07:00
parent ade9ffdacc
commit b666a4ee36

View File

@@ -56,6 +56,7 @@ import Database.Esqueleto.Experimental
( Entity(entityKey, entityVal) ( Entity(entityKey, entityVal)
, SqlBackend , SqlBackend
, (^.) , (^.)
, asc
, desc , desc
, from , from
, orderBy , orderBy
@@ -137,7 +138,7 @@ getInfoR = do
name <- getsYesod $ marketplaceName . appSettings name <- getsYesod $ marketplaceName . appSettings
allCategories <- runDB $ select $ do allCategories <- runDB $ select $ do
cats <- from $ table @Category cats <- from $ table @Category
orderBy [desc (cats ^. CategoryPriority)] orderBy [asc (cats ^. CategoryPriority)]
pure cats pure cats
pure $ InfoRes name $ categoryName . entityVal <$> allCategories pure $ InfoRes name $ categoryName . entityVal <$> allCategories