Skip to content

Commit

Permalink
[#500] Trails: Rename trailEntryEventID to trailEntryEventId to match…
Browse files Browse the repository at this point in the history
… case style used elsewhere in codebase.
  • Loading branch information
a-stacey committed Aug 19, 2019
1 parent 442a43d commit 84728ea
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion projects/trails/src/Mirza/Trails/Handlers/Trails.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ trailEntryToEntriesT :: TrailEntry -> EntriesT Identity
trailEntryToEntriesT trailEntry = EntriesT (trailEntrySignature trailEntry)
(toDbTimestamp $ getEntryTime $ trailEntryTimestamp trailEntry)
(trailEntryGS1CompanyPrefix trailEntry)
(unEventId $ trailEntryEventID trailEntry)
(unEventId $ trailEntryEventId trailEntry)
Nothing


Expand Down
2 changes: 1 addition & 1 deletion projects/trails/src/Mirza/Trails/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ data TrailEntry = TrailEntry
{ trailEntryVersion :: Integer
, trailEntryTimestamp :: EntryTime
, trailEntryGS1CompanyPrefix :: GS1CompanyPrefix
, trailEntryEventID :: EventId
, trailEntryEventId :: EventId
, trailEntryParentSignatures :: [SignaturePlaceholder]
, trailEntrySignature :: SignaturePlaceholder
} deriving (Show, Generic, Eq)
Expand Down
12 changes: 6 additions & 6 deletions projects/trails/test/Mirza/Trails/Tests/Client.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ clientSpec = do
getSingleEntryBySignatureResult `shouldMatchTrail` [singleEntry]

step "That getting a single entry trail by eventId works."
getSingleEntryByEventIdResult <- http $ getTrailByEventId (trailEntryEventID singleEntry)
getSingleEntryByEventIdResult <- http $ getTrailByEventId (trailEntryEventId singleEntry)
getSingleEntryByEventIdResult `shouldMatchTrail` [singleEntry]


Expand Down Expand Up @@ -323,7 +323,7 @@ buildEntry = do

-- This is a hack for now untril we implement signatures properly.
buildSignature :: TrailEntry -> SignaturePlaceholder
buildSignature entry = SignaturePlaceholder $ "SignaturePlaceholder-" <> (toText $ unEventId $ trailEntryEventID entry)
buildSignature entry = SignaturePlaceholder $ "SignaturePlaceholder-" <> (toText $ unEventId $ trailEntryEventId entry)


-- This function is just designed to simplify expression, see addNextEntry comment.
Expand Down Expand Up @@ -387,7 +387,7 @@ updateFirstEventId _ [] = error "Error: There is a logic error in the tests. Can

-- Updates the eventId of the entry.
updateEventId :: EventId -> TrailEntry -> TrailEntry
updateEventId eventId entry = entry{trailEntryEventID = eventId} -- TODO: Need to resign at this point...
updateEventId eventId entry = entry{trailEntryEventId = eventId} -- TODO: Need to resign at this point...


-- This function is just designed to simplify expression.
Expand All @@ -399,7 +399,7 @@ firstSignature = firstField trailEntrySignature
-- This function is just designed to simplify expression.
-- Gets the eventId of the first entry in the trail list.
firstEventId :: [TrailEntry] -> EventId
firstEventId = firstField trailEntryEventID
firstEventId = firstField trailEntryEventId


-- This function is just designed to simplify expression.
Expand Down Expand Up @@ -446,7 +446,7 @@ shouldMatchEntry (TrailEntry actual_version (EntryTime actual_timestamp) a

-- Test the 3 end points (addTrail, getTrailBySignature, getTrailByEventId) for the specified trail.
checkTrail :: (String -> IO()) -> (forall a. ClientM a -> IO (Either ServantError a)) -> String -> [TrailEntry] -> IO ()
checkTrail step http differentator trail = checkPartialTrail step http differentator trail trail (trailEntrySignature <$> trail) (trailEntryEventID <$> trail)
checkTrail step http differentator trail = checkPartialTrail step http differentator trail trail (trailEntrySignature <$> trail) (trailEntryEventId <$> trail)


checkPartialTrail :: (String -> IO()) -> (forall a. ClientM a -> IO (Either ServantError a)) -> String -> [TrailEntry] -> [TrailEntry] -> [SignaturePlaceholder] -> [EventId] -> IO ()
Expand All @@ -468,7 +468,7 @@ checkPartialTrail step http differentator inputTrail expectedTrail sigs eventIds

checkDistinctTrailsCommonEventId :: (String -> IO()) -> (forall a. ClientM a -> IO (Either ServantError a)) -> String -> [TrailEntry] -> [TrailEntry] -> EventId -> IO ()
checkDistinctTrailsCommonEventId step http differentator topTrail bottomTrail commonEventId = do
let filterNotMatchingTrailId matchingTrailId trail = filter (/= matchingTrailId) $ trailEntryEventID <$> trail
let filterNotMatchingTrailId matchingTrailId trail = filter (/= matchingTrailId) $ trailEntryEventId <$> trail

let completeTrail = topTrail <> bottomTrail
-- traceM $ "\nCompleteTrail: " <> (prettyTrail completeTrail)
Expand Down

0 comments on commit 84728ea

Please sign in to comment.