Fix handling of event_t columns.

[?]
Apr 17, 2015, 11:59 PM
FD7SV5I6VCW27HZ3T3K4MMGB2OYGJTPKFFA263TNTAMRJGQJWVNAC

Dependencies

  • [2] JV3UEPNC Fix Aeson constructors.
  • [3] A6HKMINB Attempting to improve JSON handling.
  • [4] NVOCQVAS Initial failing tests.
  • [5] GKGVYBZG Added JSON serialization to TimeLog
  • [6] Y35QCWYW Minor improvement in WorkIndex type to eliminate duplicated information.
  • [7] IZEVQF62 Work in progress replacing sqlite with postgres.
  • [8] TLQ72DSJ Lenses, sqlite-simple
  • [9] OBFPJS2G Project successfully builds and tests under nix.
  • [10] PBD7LZYQ Postgres & auth are beginning to function.
  • [11] 2KZPOGRB Once you get Haskell to compile, the tests pass!
  • [12] BROSTG5K Beginning of modularization of server.
  • [13] RSEB2NFG Replacing Snap with Scotty.
  • [14] TNR3TEHK Switch to Postgres + snaplet arch compiles.
  • [15] EZQG2APB Update task list.
  • [16] LD4GLVSF More database stuff.
  • [17] NMWWP4ZN Trying out Hspec
  • [18] 64C6AWH6 Rename Ananke -> Quixotic, project reboot.
  • [19] Z7KS5XHH Very WIP. Wow.
  • [20] EMVTF2IW WIP moving back to snap.

Change contents

  • replacement in lib/Quixotic/Database/PostgreSQL.hs at line 25
    [4.1165][4.1165:1215]()
    eventTypeParser f v = fromField f v >>= nameEvent
    [4.1165]
    [4.1215]
    eventTypeParser f v = do
    tn <- typename f
    case tn of
    "event_t" -> maybe (returnError UnexpectedNull f "") (nameEvent . decodeUtf8) v
    _ -> returnError Incompatible f "column was not of type event_t"
  • replacement in lib/Quixotic/Database/PostgreSQL.hs at line 52
    [4.1646][4.3432:3511]()
    workEventParser = WorkEvent <$> fieldWith eventTypeParser <*> field <*> field
    [4.1646]
    [4.1715]
    workEventParser = WorkEvent <$> fieldWith eventTypeParser <*> field <*> field
  • replacement in lib/Quixotic/Database/PostgreSQL.hs at line 163
    [3.2411][4.655:740](),[4.655][4.655:740]()
    "SELECT btc_addr, event_type, event_time from work_events WHERE project_id = ?"
    [3.2411]
    [4.740]
    "SELECT btc_addr, event_type, event_time, event_metadata from work_events WHERE project_id = ?"
  • edit in lib/Quixotic/TimeLog.hs at line 2
    [4.3530]
    [4.883]
    {-# LANGUAGE DeriveDataTypeable #-}
  • replacement in lib/Quixotic/TimeLog.hs at line 38
    [4.1225][4.3657:3715]()
    data EventType = StartWork | StopWork deriving (Show, Eq)
    [4.1225]
    [4.5414]
    data EventType = StartWork | StopWork deriving (Show, Eq, Typeable)
  • replacement in lib/Quixotic/TimeLog.hs at line 54
    [4.3997][4.3997:4023]()
    , _eventMeta :: A.Value
    [4.3997]
    [4.4037]
    , _eventMeta :: Maybe A.Value
  • replacement in server/Quixotic/Snaplet/WorkLog.hs at line 28
    [4.6042][4.4362:4460]()
    let em = maybe A.Null id $ A.decode requestBody
    workEvent = WorkEvent evType timestamp em
    [4.6042]
    [4.4128]
    let workEvent = WorkEvent evType timestamp $ A.decode requestBody
  • replacement in sql/quixotic-pg.sql at line 29
    [4.4597][4.4597:4624]()
    event_meta json not null
    [4.4597]
    [4.4421]
    event_metadata json not null
  • edit in test/Quixotic/TimeLogSpec.hs at line 6
    [4.1681][2.3:36]()
    import qualified Data.Aeson as A
  • replacement in test/Quixotic/TimeLogSpec.hs at line 33
    [4.3132][2.37:151]()
    [ LogEntry addr (WorkEvent StartWork start' A.Null), LogEntry addr (WorkEvent StopWork end' A.Null) ]
    [4.3132]
    [4.417]
    [ LogEntry addr (WorkEvent StartWork start' Nothing), LogEntry addr (WorkEvent StopWork end' Nothing) ]