diff --git a/src/MiniDocs/GrafoscopioNode.class.st b/src/MiniDocs/GrafoscopioNode.class.st index 68f5379..7e9274b 100644 --- a/src/MiniDocs/GrafoscopioNode.class.st +++ b/src/MiniDocs/GrafoscopioNode.class.st @@ -81,9 +81,19 @@ GrafoscopioNode >> created: anObject [ created := anObject ] +{ #category : #accessing } +GrafoscopioNode >> earliestCreationDate [ + | earliest | + + earliest := self nodesWithCreationDates first created. + self nodesWithCreationDates do: [:node | + node created <= earliest ifTrue: [ earliest := node created ] ]. + ^ earliest +] + { #category : #accessing } GrafoscopioNode >> edited [ - ^ edited asDateAndTime + ^ edited ifNotNil: [^ edited asDateAndTime ] ] { #category : #accessing } @@ -139,6 +149,16 @@ GrafoscopioNode >> nodesInPreorder: anObject [ nodesInPreorder := anObject ] +{ #category : #accessing } +GrafoscopioNode >> nodesWithCreationDates [ + ^ self nodesInPreorder select: [ :each | each created isNotNil ] +] + +{ #category : #accessing } +GrafoscopioNode >> nodesWithEditionDates [ + ^ self nodesInPreorder select: [ :each | each edited isNotNil ] +] + { #category : #accessing } GrafoscopioNode >> parent [ ^ parent @@ -149,6 +169,16 @@ GrafoscopioNode >> parent: anObject [ parent := anObject ] +{ #category : #accessing } +GrafoscopioNode >> populateTimestamps [ + + (self nodesInPreorder size = self nodesWithCreationDates size + and: [ self nodesInPreorder size = self nodesWithEditionDates size ]) + ifTrue: [ ^ self nodesInPreorder ]. + ^ { self nodesWithCreationDates. + self nodesWithEditionDates} +] + { #category : #accessing } GrafoscopioNode >> printOn: aStream [ super printOn: aStream. diff --git a/src/MiniDocs/GrafoscopioNodeTest.class.st b/src/MiniDocs/GrafoscopioNodeTest.class.st new file mode 100644 index 0000000..f05c0d7 --- /dev/null +++ b/src/MiniDocs/GrafoscopioNodeTest.class.st @@ -0,0 +1,15 @@ +Class { + #name : #GrafoscopioNodeTest, + #superclass : #TestCase, + #category : #MiniDocs +} + +{ #category : #accessing } +GrafoscopioNodeTest >> testEarliestCreationNode [ + | notebook remoteNotebook offedingNodes | + remoteNotebook := 'https://mutabit.com/repos.fossil/documentaton/raw/a63598382?at=documentaton.ston'. + notebook := (STON fromString: remoteNotebook asUrl retrieveContents utf8Decoded) first parent. + offedingNodes := notebook nodesInPreorder select: [:node | + node created isNotNil and: [node created < notebook earliestCreationDate] ]. + self assert: offedingNodes size equals: 0 +]