@@ -30,16 +30,21 @@ graphAsRelation discon@(DisconnectedTransaction parentUUID _) graph@(Transaction
31 attributes = M.fromList [("id", Attribute "id" StringAtomType),
31 attributes = M.fromList [("id", Attribute "id" StringAtomType),
32 ("parents", Attribute "parents" (RelationAtomType parentAttributes)),
32 ("parents", Attribute "parents" (RelationAtomType parentAttributes)),
33− ("current", Attribute "current" IntAtomType)
33+ ("current", Attribute "current" IntAtomType),
34+ ("head", Attribute "head" StringAtomType)
35 parentAttributes = M.fromList [("id", Attribute "id" StringAtomType)]
36 parentAttributes = M.fromList [("id", Attribute "id" StringAtomType)]
36 tupleGenerator transaction = case transactionParentsRelation transaction graph of
37 tupleGenerator transaction = case transactionParentsRelation transaction graph of
37 Left err -> Left err
38 Left err -> Left err
38− Right parentTransRel -> Right $ mkRelationTuple (S.fromList ["id", "parents", "current"]) $
39+ Right parentTransRel -> Right $ mkRelationTuple (S.fromList ["id", "parents", "current", "head"]) $
39 (M.fromList
40 (M.fromList
40 [("id", StringAtom $ show (transactionUUID transaction)),
41 [("id", StringAtom $ show (transactionUUID transaction)),
41 ("parents", RelationAtom parentTransRel),
42 ("parents", RelationAtom parentTransRel),
42− ("current", IntAtom $ if parentUUID == transactionUUID transaction then 1 else 0)])
43+ ("current", IntAtom $ if parentUUID == transactionUUID transaction then 1 else 0),
44+ ("head", StringAtom $ case headNameForTransaction transaction graph of
45+ Just headName -> headName
44transactionParentsRelation :: Transaction -> TransactionGraph -> Either RelationalError Relation
49transactionParentsRelation :: Transaction -> TransactionGraph -> Either RelationalError Relation
45transactionParentsRelation trans graph = do
50transactionParentsRelation trans graph = do