Skip to content

Commit

Permalink
refactoring: Add null-object-pattern for card & fix red tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke committed Jul 31, 2022
1 parent f9f4b90 commit e238095
Show file tree
Hide file tree
Showing 118 changed files with 481 additions and 216 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
addAssignee: anSPBAssignee

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-local
addAssigneeLocal: anSPBAssignee

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
addLabel: anSPBLabel

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-local
addLabelLocal: anSPBLabel

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
assignees

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
description

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialization
initialize

super initialize.
self color: Color gray.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
testing
isRealCard

^ false.
4 changes: 4 additions & 0 deletions Squello-Core.package/SPBAbstractCard.class/instance/labels.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
labels

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
removeAssignee: anSPBAssignee

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-local
removeAssigneeLocal: anSPBAssignee

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
removeLabel: anSPBLabel

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-local
removeLabelLocal: anSPBLabel

self subclassResponsibility.
4 changes: 4 additions & 0 deletions Squello-Core.package/SPBAbstractCard.class/instance/title.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
accessing
title

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
updateDescription: aString

self subclassResponsibility.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
updating-remote
updateTitle: aString

self subclassResponsibility.
20 changes: 20 additions & 0 deletions Squello-Core.package/SPBAbstractCard.class/methodProperties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"class" : {
},
"instance" : {
"addAssignee:" : "lo 7/31/2022 17:03",
"addAssigneeLocal:" : "lo 7/31/2022 17:03",
"addLabel:" : "lo 7/31/2022 17:04",
"addLabelLocal:" : "lo 7/31/2022 17:04",
"assignees" : "lo 7/31/2022 16:04",
"description" : "lo 7/31/2022 16:06",
"initialize" : "lo 7/31/2022 16:02",
"isRealCard" : "lo 7/31/2022 17:03",
"labels" : "lo 7/31/2022 16:06",
"removeAssignee:" : "lo 7/31/2022 17:04",
"removeAssigneeLocal:" : "lo 7/31/2022 17:04",
"removeLabel:" : "lo 7/31/2022 17:04",
"removeLabelLocal:" : "lo 7/31/2022 17:04",
"title" : "lo 7/31/2022 16:06",
"updateDescription:" : "lo 7/31/2022 17:04",
"updateTitle:" : "lo 7/31/2022 17:04" } }
14 changes: 14 additions & 0 deletions Squello-Core.package/SPBAbstractCard.class/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"category" : "Squello-Core",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
],
"name" : "SPBAbstractCard",
"pools" : [
],
"super" : "Morph",
"type" : "normal" }
4 changes: 2 additions & 2 deletions Squello-Core.package/SPBBoard.class/instance/activeCard..st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
activeCard: anSPBCard
activeCard: anSPBAbstractCard

activeCard := anSPBCard.
activeCard := anSPBAbstractCard.
2 changes: 1 addition & 1 deletion Squello-Core.package/SPBBoard.class/instance/activeCard.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
activeCard

^ activeCard.
^ activeCard ifNil: [activeCard := SPBNullCard new].
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
update sidebar
activeCardAssigneeList

self activeCard
ifNil: [^ {}].
self activeCard assignees
ifNil: [^ {#('---assigned---')}].
^ #('---assigned---') , self activeCard assignees.
^ self activeCardAssigneeListHeader , self activeCard assignees.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
update sidebar
activeCardAssigneeListHeader

^ #('---assigned---').
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
update sidebar
activeCardDescription

self activeCard
ifNil: [^ ''].
^ self activeCard description ifNil: [''].
^ self activeCard description.
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
update sidebar
activeCardLabelList

self activeCard
ifNil: [^ {}].
self activeCard labels
ifNil: [^ {#('---used labels---')}].
^ #('---used labels---'), self activeCard labels.
^ self activeCardLabelListHeader, self activeCard labels.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
update sidebar
activeCardLabelListHeader

^ #('---used labels---').
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
update sidebar
activeCardTitle

self activeCard
ifNil: [^ ''].
^ self activeCard title ifNil: [''].
^ self activeCard title.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
assigneeSelected: anObject
assigneeSelected: anSPBAssignee

(anObject isKindOf: SPBAssignee)
(anSPBAssignee isKindOf: SPBAssignee)
ifFalse: [^ self].
assigneeSelected := anObject.
assigneeSelected := anSPBAssignee.
self changed: #assigneeSelected.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
accessing
boardProvider: anObject
boardProvider: anSPBGithubBoardProvider

boardProvider := anObject.
boardProvider := anSPBGithubBoardProvider.
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
drag and drop
dropOnAssignees: anSPBAssignee at: index

| assignees |
assignees := self activeCard assignees.
(anSPBAssignee isKindOf: SPBAssignee)
ifFalse: [^ self inform: 'Can only drop assignees'].
(assignees
anySatisfy: [:each | each = anSPBAssignee])
ifTrue: [^ self].
self activeCard assignees add: anSPBAssignee.
self activeCard updateAssigneeCount.
self changed: #potentialAssigneesList.
self changed: #activeCardAssigneeList.
self boardProvider addAssignee: anSPBAssignee toCard: self activeCard.

self activeCard addAssignee: anSPBAssignee.
self
changed: #potentialAssigneesList;
changed: #activeCardAssigneeList.
15 changes: 5 additions & 10 deletions Squello-Core.package/SPBBoard.class/instance/dropOnLabels.at..st
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
drag and drop
dropOnLabels: anSPBLabel at: index

| labels |
labels := self activeCard labels.
(anSPBLabel isKindOf: SPBLabel)
ifFalse: [^ self inform: 'Can only drop labels'].
(labels
anySatisfy: [:each | each = anSPBLabel])
ifTrue: [^ self].
self activeCard labels add: anSPBLabel.
self activeCard updateLabelIcons.
self changed: #potentialLabelsList.
self changed: #activeCardLabelList.
self boardProvider addLabel: anSPBLabel toCard: self activeCard.

self activeCard addLabel: anSPBLabel.
self
changed: #potentialLabelsList;
changed: #activeCardLabelList.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ dropOnPotentialAssignees: anSPBAssignee at: index

(anSPBAssignee isKindOf: SPBAssignee)
ifFalse: [^ self inform: 'Can only drop assignees'].
self activeCard assignees remove: anSPBAssignee
ifAbsent: [].
self activeCard updateAssigneeCount.
self changed: #potentialAssigneesList.
self changed: #activeCardAssigneeList.
self boardProvider deleteAssignee: anSPBAssignee fromCard: self activeCard.

self activeCard removeAssignee: anSPBAssignee.
self
changed: #potentialAssigneesList;
changed: #activeCardAssigneeList.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ dropOnPotentialLabels: anSPBLabel at: index

(anSPBLabel isKindOf: SPBLabel)
ifFalse: [^ self inform: 'Can only drop labels'].
self activeCard labels remove: anSPBLabel
ifAbsent: [].
self activeCard updateLabelIcons.
self changed: #potentialLabelsList.
self changed: #activeCardLabelList.
self boardProvider deleteLabel: anSPBLabel fromCard: self activeCard.

self activeCard removeLabel: anSPBLabel.
self
changed: #potentialLabelsList;
changed: #activeCardLabelList.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
labelSelected: anObject
labelSelected: anSPBLabel

(anObject isKindOf: SPBLabel)
(anSPBLabel isKindOf: SPBLabel)
ifFalse: [^ self].
labelSelected := anObject.
labelSelected := anSPBLabel.
self changed: #labelSelected.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
potentialAssigneeSelected: anObject
potentialAssigneeSelected: anSPBAssignee

(anObject isKindOf: SPBAssignee)
(anSPBAssignee isKindOf: SPBAssignee)
ifFalse: [^ self].
potentialAssigneeSelected := anObject.
potentialAssigneeSelected := anSPBAssignee.
self changed: #potentialAssigneeSelected.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ potentialAssigneesList

| potentialAssignees assignees |
potentialAssignees := self potentialAssignees deepCopy.
self activeCard
ifNil: [^ {}].
assignees := self activeCard assignees.
self activeCard isRealCard
ifFalse: [^ self potentialAssigneesListHeader].
potentialAssignees
ifNil: [^ {#('---unassigned---')}].
^ #('---unassigned---'),
ifNil: [^ self potentialAssigneesListHeader].
^ self potentialAssigneesListHeader,
potentialAssignees select: [:each | (assignees anySatisfy: [:elem | elem = each]) not].

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
update sidebar
potentialAssigneesListHeader

^ #('---unassigned---').
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
accessing
potentialLabelSelected: anObject
potentialLabelSelected: anSPBLabel

(anObject isKindOf: SPBLabel)
(anSPBLabel isKindOf: SPBLabel)
ifFalse: [^ self].
potentialLabelSelected := anObject.
potentialLabelSelected := anSPBLabel.
self changed: #potentialLabelSelected.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ potentialLabelsList

| potentialLabels labels |
potentialLabels := self potentialLabels deepCopy.
self activeCard
ifNil: [^ {}].
labels := self activeCard labels.
self activeCard isRealCard
ifFalse: [^ self potentialLabelsListHeader].
potentialLabels
ifNil: [^ {#('---not used labels---')}].
^ #('---not used labels---'),
ifNil: [^ self potentialLabelsListHeader].
^ self potentialLabelsListHeader,
potentialLabels select: [:each | (labels anySatisfy: [:elem | elem = each]) not].
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
update sidebar
potentialLabelsListHeader

^ #('---not used labels---').
Loading

0 comments on commit e238095

Please sign in to comment.