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PELIT2V74L62AMMXM2M5BHYAACALAC
CI4OPKQMU4CIX3QPGA5GWSEOPJ2FAREDBVU6X33E7X3EEQXAICRQC
following commands to initialize the database. The postgres user's password is
specified in the docker-compose file.
`deploy/dbinit.sh` script to initialize the database. The postgres user's password
can be specified in the docker-compose file.
#!/bin/bash
createuser -h localhost -U postgres -W -P aftok
createdb -h localhost -U postgres -W -O aftok aftok
psql -h localhost -U postgres -W aftok \
-c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;'
if [ -n "$1" ]; then
psql -h localhost -U aftok -W aftok < $1
fi
_timeDevoted = Hours . (`div` 3600) . round . C.toSeconds' $ ws ^. wsLogged,
_loggedHours = Hours . (`div` 3600) . round . C.toSeconds' $ ws ^. wsLogged,
_depreciatedHours = Hours . (`div` 3600) . round . C.toSeconds' $ ws ^. wsDepreciated,
it "correctly handles fully depreciated work intervals" $ do
now <- C.getCurrentTime
let depf = toDepF $ DepreciationRules (LinearDepreciation 6 2) Nothing
raw = [
("b3ff64b7-6699-45f2-acee-38751325bf46", StartWork, "2021-02-09T15:52:13.434308+00"),
("b3ff64b7-6699-45f2-acee-38751325bf46", StopWork, "2021-02-09T16:12:32.936579+00"),
("d56ae5bd-8892-44c6-9a02-f6a8aca8636e", StartWork, "2021-02-09T16:23:10.637749+00"),
("d56ae5bd-8892-44c6-9a02-f6a8aca8636e", StopWork, "2021-02-09T16:27:00.082747+00"),
("d56ae5bd-8892-44c6-9a02-f6a8aca8636e", StartWork, "2021-02-09T16:29:10.119337+00"),
("d56ae5bd-8892-44c6-9a02-f6a8aca8636e", StopWork, "2021-02-09T18:54:26.778107+00")]
toEvent :: (String, C.UTCTime -> LogEvent, String) -> Maybe LogEntry
toEvent (uuid, f, t) =
LogEntry <$> (CreditToUser . UserId <$> U.fromString uuid)
<*> (f . C.toThyme <$> parseISO8601 t)
<*> pure Nothing
events = catMaybes $ fmap toEvent raw
widx = workIndex (view event) events
p = payouts depf now widx
p `shouldBe` WorkShares 0 M.empty