on master help sign in
add some more info to :showGraph
commitef962242ab3db86a4ca159e262bad49ba0881125 authorAgentM <agentm@themactionfaction.com> dateFri 17 Apr 2015, 22:51 (12 years ago) parent76d384c
3 files changed+12−5
RelationAttribute.hs+3−1 RelationalTransactionShow.hs+8−3 TutorialDInterpreter.hs+1−1
RelationAttribute.hs+3−1
@@ -3,6 +3,7 @@ import RelationType
33import qualified Data.Map as M
44import qualified Data.Set as S
55import qualified Data.List as L
6+import Debug.Trace
67
78renameAttribute :: AttributeName -> Attribute -> Attribute
89renameAttribute newAttrName (Attribute oldAttrName typeo) = Attribute newAttrName typeo
@@ -34,8 +35,9 @@ matchingAttributeNameSet = S.intersection
3435sortedAttributeNameList attrNameSet= L.sort $ S.toList attrNameSet
3536
3637-- take two attribute sets and return an attribute set with the attributes which do not match
38+-- bug: missing attributes don't show up (?)
3739attributesDifference :: Attributes -> Attributes -> Attributes
38−attributesDifference attrA attrB = M.union mismatchA missingB
40+attributesDifference attrA attrB = trace (show attrA ++ "\n" ++ show attrB) (M.union mismatchA missingB)
3941 where
4042 mismatchA = M.foldrWithKey folder M.empty attrA
4143 missingB = M.difference attrA attrB
RelationalTransactionShow.hs+8−3
@@ -30,16 +30,21 @@ graphAsRelation discon@(DisconnectedTransaction parentUUID _) graph@(Transaction
3030 where
3131 attributes = M.fromList [("id", Attribute "id" StringAtomType),
3232 ("parents", Attribute "parents" (RelationAtomType parentAttributes)),
33− ("current", Attribute "current" IntAtomType)
33+ ("current", Attribute "current" IntAtomType),
34+ ("head", Attribute "head" StringAtomType)
3435 ]
3536 parentAttributes = M.fromList [("id", Attribute "id" StringAtomType)]
3637 tupleGenerator transaction = case transactionParentsRelation transaction graph of
3738 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"]) $
3940 (M.fromList
4041 [("id", StringAtom $ show (transactionUUID transaction)),
4142 ("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
46+ Nothing -> "_")
47+ ])
4348
4449transactionParentsRelation :: Transaction -> TransactionGraph -> Either RelationalError Relation
4550transactionParentsRelation trans graph = do
TutorialDInterpreter.hs+1−1
@@ -395,7 +395,7 @@ evalGraphOp :: U.UUID -> DisconnectedTransaction -> TransactionGraph -> GraphOpe
395395--affects only disconncted transaction
396396evalGraphOp newUUID trans graph (JumpToTransaction jumpUUID) = case transactionForUUID jumpUUID graph of
397397 Left err -> Left err
398− Right parentTrans -> Right (newTrans, graph, NoActionResult)
398+ Right parentTrans -> Right (newTrans, graph, QuietSuccessResult)
399399 where
400400 newTrans = DisconnectedTransaction jumpUUID (transactionContext parentTrans)
401401