diff --git a/app/Main.hs b/app/Main.hs index 1787262..732e6ab 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -11,6 +11,9 @@ import Control.Monad.Trans.Resource (runResourceT) import Data.ByteString.Lazy as BS import Data.List as List import Data.Text as T +import Data.Text.Lazy qualified as T (toStrict) +import Data.Text.Lazy.Builder qualified as B +import Data.Text.Lazy.Builder.Int qualified as B import Data.Time.Clock (nominalDiffTimeToSeconds) import Data.Time.Clock.POSIX (posixSecondsToUTCTime, utcTimeToPOSIXSeconds) import Database.Persist.Postgresql (ConnectionPool, ConnectionString, SqlBackend, getPgInterval, runMigration, runSqlPool, withPostgresqlPool) @@ -56,10 +59,13 @@ instance YesodPersist Souplesse where Souplesse pool _ <- getYesod runSqlPool action pool +intToText :: Integral a => a -> T.Text +intToText = T.toStrict . B.toLazyText . B.decimal + getCalendarR :: Handler Html getCalendarR = do - let fTime = T.pack . show . floor . utcTimeToPOSIXSeconds - fDur = T.pack . show . ceiling . nominalDiffTimeToSeconds . getPgInterval + let fTime = intToText . floor . utcTimeToPOSIXSeconds + fDur = intToText . ceiling . nominalDiffTimeToSeconds . getPgInterval (formWidget, _) <- generateFormPost uploadForm sessions' <- runDB Session.recents defaultLayout