Remove superfluous dialogs.

Commit
d2a57e781f7ec7b69868a83a28722ba776d2ab86
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
Changed files
src/MyFitnessTracker/MFTExerciseDialog.class.st
index 61458c4f..00000000 100644..000000
@@ -1,77 +0,0 @@
1 Removed: Class {
2 Removed: #name : #MFTExerciseDialog,
3 Removed: #superclass : #MFTDialog,
4 Removed: #instVars : [
5 Removed: 'allExercises',
6 Removed: 'selectedExercise'
7 Removed: ],
8 Removed: #category : #'MyFitnessTracker-Dialog'
9 Removed: }
10 Removed:
11 Removed: { #category : #actions }
12 Removed: MFTExerciseDialog class >> edit: aMFTExercise [
13 Removed:
14 Removed: ^ self new
15 Removed: exercise: aMFTExercise;
16 Removed: sets: aMFTExercise sets;
17 Removed: action: #edit;
18 Removed: yourself
19 Removed: ]
20 Removed:
21 Removed: { #category : #accessing }
22 Removed: MFTExerciseDialog >> allExercises [
23 Removed:
24 Removed: ^ allExercises
25 Removed: ]
26 Removed:
27 Removed: { #category : #accessing }
28 Removed: MFTExerciseDialog >> allExercises: anObject [
29 Removed:
30 Removed: allExercises := anObject
31 Removed: ]
32 Removed:
33 Removed: { #category : #initialization }
34 Removed: MFTExerciseDialog >> initialize [
35 Removed:
36 Removed: super initialize.
37 Removed: allExercises := MFTSQLite3Database allExercises.
38 Removed: selectedExercise := allExercises first
39 Removed: ]
40 Removed:
41 Removed: { #category : #rendering }
42 Removed: MFTExerciseDialog >> renderContentOn: html [
43 Removed:
44 Removed: self renderDialogOn: html with: [ self renderExerciseSelectOn: html ]
45 Removed: ]
46 Removed:
47 Removed: { #category : #rendering }
48 Removed: MFTExerciseDialog >> renderExerciseSelectOn: html [
49 Removed:
50 Removed: selectedExercise := allExercises
51 Removed: detect: [ :exercise |
52 Removed: exercise id = selectedExercise id ]
53 Removed: ifNone: [ allExercises first ].
54 Removed: html formGroup: [
55 Removed: html label: 'Exercise'.
56 Removed: html select formControl
57 Removed: list: allExercises;
58 Removed: selected: selectedExercise;
59 Removed: callback: [ :value | selectedExercise := value ];
60 Removed: labels: [ :each | each englishName ] ]
61 Removed: ]
62 Removed:
63 Removed: { #category : #delegation }
64 Removed: MFTExerciseDialog >> renderSubmitOn: html [
65 Removed:
66 Removed: html buttonGroup: [
67 Removed: html formButton
68 Removed: beSubmit;
69 Removed: bePrimary;
70 Removed: callback: [ self answer: selectedExercise ];
71 Removed: with: (completion ifNil: [ 'Submit' ] ifNotNil: [ 'Next' ]).
72 Removed: html formButton
73 Removed: beSubmit;
74 Removed: beSecondary;
75 Removed: callback: [ self answer: nil ];
76 Removed: with: (completion ifNil: [ 'Cancel' ] ifNotNil: [ 'Skip' ]) ]
77 Removed: ]
src/MyFitnessTracker/MFTExerciseDialogOld.class.st
index 7983d21f..00000000 100644..000000
@@ -1,170 +0,0 @@
1 Removed: Class {
2 Removed: #name : #MFTExerciseDialogOld,
3 Removed: #superclass : #MFTDialog,
4 Removed: #instVars : [
5 Removed: 'exercise',
6 Removed: 'sets'
7 Removed: ],
8 Removed: #category : #'MyFitnessTracker-Dialog'
9 Removed: }
10 Removed:
11 Removed: { #category : #actions }
12 Removed: MFTExerciseDialogOld class >> edit: aMFTExercise [
13 Removed:
14 Removed: ^ self new
15 Removed: exercise: aMFTExercise;
16 Removed: sets: aMFTExercise sets;
17 Removed: action: #edit;
18 Removed: yourself
19 Removed: ]
20 Removed:
21 Removed: { #category : #accessing }
22 Removed: MFTExerciseDialogOld >> exercise [
23 Removed:
24 Removed: ^ exercise
25 Removed: ]
26 Removed:
27 Removed: { #category : #accessing }
28 Removed: MFTExerciseDialogOld >> exercise: anObject [
29 Removed:
30 Removed: exercise := anObject
31 Removed: ]
32 Removed:
33 Removed: { #category : #initialization }
34 Removed: MFTExerciseDialogOld >> initialize [
35 Removed:
36 Removed: super initialize.
37 Removed: exercise := MFTExercise new.
38 Removed: sets := OrderedCollection new
39 Removed: ]
40 Removed:
41 Removed: { #category : #rendering }
42 Removed: MFTExerciseDialogOld >> renderAddSetRowOn: html [
43 Removed:
44 Removed: html tableRow: [
45 Removed: html tableData: [
46 Removed: html outlineButton
47 Removed: bePrimary;
48 Removed: beSmall;
49 Removed: callback: [ sets add: MFTSet new ];
50 Removed: with: 'Add' ].
51 Removed: html
52 Removed: tableData;
53 Removed: tableData;
54 Removed: tableData ]
55 Removed: ]
56 Removed:
57 Removed: { #category : #rendering }
58 Removed: MFTExerciseDialogOld >> renderContentOn: html [
59 Removed:
60 Removed: self renderDialogOn: html with: [
61 Removed: self renderExercisesSelectOn: html.
62 Removed: self renderSetGroupTableOn: html ]
63 Removed: ]
64 Removed:
65 Removed: { #category : #rendering }
66 Removed: MFTExerciseDialogOld >> renderExerciseSelectOn: html [
67 Removed:
68 Removed: | allExercises selectedExercise |
69 Removed: allExercises := MFTUtils allExercises.
70 Removed: selectedExercise := allExercises
71 Removed: detect: [ :each |
72 Removed: each englishName = exercise englishName ]
73 Removed: ifNone: [ nil ].
74 Removed: html formGroup: [
75 Removed: html label: 'Exercise'.
76 Removed: html select formControl
77 Removed: list: allExercises;
78 Removed: selected: selectedExercise;
79 Removed: callback: [ :value | exercise := value ];
80 Removed: labels: [ :each | each englishName ] ]
81 Removed: ]
82 Removed:
83 Removed: { #category : #rendering }
84 Removed: MFTExerciseDialogOld >> renderSetsRowsOn: html [
85 Removed: "TODO: something fishy is going on here. Why are reps and rpe instantiated as nil, but become the empty string after adding additional empty sets?"
86 Removed:
87 Removed: sets doWithIndex: [ :set :i |
88 Removed: html tableRow: [
89 Removed: html tableData: [
90 Removed: html buttonGroup: [
91 Removed: html outlineButton
92 Removed: beDanger;
93 Removed: beSmall;
94 Removed: callback: [ sets removeAt: i ];
95 Removed: with: 'Remove'.
96 Removed: html outlineButton
97 Removed: beSecondary;
98 Removed: beSmall;
99 Removed: callback: [ sets add: set copy afterIndex: i ];
100 Removed: with: 'Duplicate' ] ].
101 Removed: html tableData: [
102 Removed: html numberInput formControl
103 Removed: value: set reps;
104 Removed: callback: [ :value | set reps: value asInteger ] ].
105 Removed: html tableData: [
106 Removed: html numberInput formControl
107 Removed: value: set weight;
108 Removed: callback: [ :value |
109 Removed: value
110 Removed: ifNotEmpty: [ set weight: value asNumber ]
111 Removed: ifEmpty: [ set weight: nil ] ] ].
112 Removed: html tableData: [
113 Removed: html numberInput formControl
114 Removed: value: set rpe;
115 Removed: callback: [ :value |
116 Removed: value
117 Removed: ifNotEmpty: [ set rpe: value asInteger ]
118 Removed: ifEmpty: [ set rpe: nil ] ] ] ] ]
119 Removed: ]
120 Removed:
121 Removed: { #category : #rendering }
122 Removed: MFTExerciseDialogOld >> renderSetsTableOn: html [
123 Removed:
124 Removed: html formGroup: [
125 Removed: html label: 'Sets'.
126 Removed: html table
127 Removed: class: 'table table-hover';
128 Removed: with: [
129 Removed: sets ifNotEmpty: [ self renderTableHeaderOn: html ].
130 Removed: self renderSetsRowsOn: html.
131 Removed: self renderAddSetRowOn: html ] ]
132 Removed: ]
133 Removed:
134 Removed: { #category : #delegation }
135 Removed: MFTExerciseDialogOld >> renderSubmitOn: html [
136 Removed:
137 Removed: html buttonGroup: [
138 Removed: html formButton
139 Removed: beSubmit;
140 Removed: bePrimary;
141 Removed: callback: [ self answer: (exercise sets: sets) ];
142 Removed: with: (completion ifNil: [ 'Submit' ] ifNotNil: [ 'Next' ]).
143 Removed: html formButton
144 Removed: beSubmit;
145 Removed: beSecondary;
146 Removed: callback: [ self answer: MFTExercise new ];
147 Removed: with: (completion ifNil: [ 'Cancel' ] ifNotNil: [ 'Skip' ]) ]
148 Removed: ]
149 Removed:
150 Removed: { #category : #rendering }
151 Removed: MFTExerciseDialogOld >> renderTableHeaderOn: html [
152 Removed:
153 Removed: html tableHead: [
154 Removed: html
155 Removed: tableHeading;
156 Removed: tableHeading: 'Reps';tableHeading: 'Weight';
157 Removed: tableHeading: 'RPE' ]
158 Removed: ]
159 Removed:
160 Removed: { #category : #accessing }
161 Removed: MFTExerciseDialogOld >> sets [
162 Removed:
163 Removed: ^ sets
164 Removed: ]
165 Removed:
166 Removed: { #category : #accessing }
167 Removed: MFTExerciseDialogOld >> sets: anObject [
168 Removed:
169 Removed: sets := anObject
170 Removed: ]
src/MyFitnessTracker/MFTExercisesDialog.class.st
index 634da467..00000000 100644..000000
@@ -1,147 +0,0 @@
1 Removed: Class {
2 Removed: #name : #MFTExercisesDialog,
3 Removed: #superclass : #MFTDialog,
4 Removed: #instVars : [
5 Removed: 'exercises'
6 Removed: ],
7 Removed: #category : #'MyFitnessTracker-Dialog'
8 Removed: }
9 Removed:
10 Removed: { #category : #actions }
11 Removed: MFTExercisesDialog class >> edit: aMFTExerciseCollection [
12 Removed:
13 Removed: self halt.
14 Removed: ^ self new
15 Removed: exercises: aMFTExerciseCollection;
16 Removed: action: #edit;
17 Removed: yourself
18 Removed: ]
19 Removed:
20 Removed: { #category : #adding }
21 Removed: MFTExercisesDialog >> addExercise [
22 Removed:
23 Removed: | exercise |
24 Removed: exercise := self call: MFTExerciseDialog new.
25 Removed: exercise ifNotNil: [ exercises add: exercise ]
26 Removed: ]
27 Removed:
28 Removed: { #category : #accessing }
29 Removed: MFTExercisesDialog >> editExerciseAt: i [
30 Removed:
31 Removed: | oldExercise newExercise |
32 Removed: oldExercise := exercises at: i.
33 Removed: newExercise := self call: (MFTExerciseDialog edit: oldExercise).
34 Removed: newExercise ifNotNil: [ exercises at: i put: newExercise ]
35 Removed: ]
36 Removed:
37 Removed: { #category : #accessing }
38 Removed: MFTExercisesDialog >> exercises [
39 Removed:
40 Removed: ^ exercises
41 Removed: ]
42 Removed:
43 Removed: { #category : #accessing }
44 Removed: MFTExercisesDialog >> exercises: aCollection [
45 Removed:
46 Removed: exercises := aCollection
47 Removed: ]
48 Removed:
49 Removed: { #category : #initialization }
50 Removed: MFTExercisesDialog >> initialize [
51 Removed:
52 Removed: super initialize.
53 Removed: exercises := OrderedCollection new
54 Removed: ]
55 Removed:
56 Removed: { #category : #rendering }
57 Removed: MFTExercisesDialog >> renderAddExerciseRowOn: html [
58 Removed:
59 Removed: html buttonGroup: [
60 Removed: html outlineButton
61 Removed: bePrimary;
62 Removed: beSmall;
63 Removed: callback: [ self addExercise ];
64 Removed: with: 'Add' ]
65 Removed: ]
66 Removed:
67 Removed: { #category : #rendering }
68 Removed: MFTExercisesDialog >> renderContentOn: html [
69 Removed:
70 Removed: self renderDialogOn: html with: [
71 Removed: html table
72 Removed: class: 'table table-hover';
73 Removed: with: [ exercises ifNotEmpty: [ self renderExerciseTableOn: html ] ].
74 Removed: self renderAddExerciseRowOn: html ]
75 Removed: ]
76 Removed:
77 Removed: { #category : #rendering }
78 Removed: MFTExercisesDialog >> renderExerciseActionsButtonGroupOn: html at: i [
79 Removed:
80 Removed: html buttonGroup: [
81 Removed: html outlineButton
82 Removed: beSecondary;
83 Removed: beSmall;
84 Removed: callback: [ exercises removeAt: i ];
85 Removed: with: 'Delete'.
86 Removed: html outlineButton
87 Removed: beSecondary;
88 Removed: beSmall;
89 Removed: callback: [ self editExerciseAt: i ];
90 Removed: with: 'Edit' ]
91 Removed: ]
92 Removed:
93 Removed: { #category : #rendering }
94 Removed: MFTExercisesDialog >> renderExerciseTableOn: html [
95 Removed:
96 Removed: self renderExercisesTableHeaderOn: html.
97 Removed: exercises doWithIndex: [ :exercise :i |
98 Removed: html tableRow: [
99 Removed: html tableData: [
100 Removed: self renderExerciseActionsButtonGroupOn: html at: i ].
101 Removed: html tableData: exercise englishName.
102 Removed: html tableData: exercise primaryMuscle englishName.
103 Removed: ((exercises collect: #sets) anySatisfy: #isNotEmpty) ifTrue: [
104 Removed: html tableData
105 Removed: style: 'text-align: right';
106 Removed: with: exercise repsBySet size ].
107 Removed: ((exercises collect: #volume) anySatisfy: [ :volume | volume ~~ 0 ])
108 Removed: ifTrue: [
109 Removed: html tableData
110 Removed: style: 'text-align: right';
111 Removed: with: exercise volume ] ] ]
112 Removed: ]
113 Removed:
114 Removed: { #category : #rendering }
115 Removed: MFTExercisesDialog >> renderExercisesTableHeaderOn: html [
116 Removed:
117 Removed: html tableHead: [
118 Removed: html
119 Removed: tableHeading;
120 Removed: tableHeading: 'Exercise';
121 Removed: tableHeading: 'Primary Muscle'.
122 Removed: ((exercises collect: #sets) anySatisfy: #isNotEmpty) ifTrue: [
123 Removed: html tableHeading
124 Removed: style: 'text-align: right';
125 Removed: with: 'Sets' ].
126 Removed: ((exercises collect: #volume) anySatisfy: [ :volume | volume ~~ 0 ])
127 Removed: ifTrue: [
128 Removed: html tableHeading
129 Removed: style: 'text-align: right';
130 Removed: with: 'Volume' ] ]
131 Removed: ]
132 Removed:
133 Removed: { #category : #rendering }
134 Removed: MFTExercisesDialog >> renderSubmitOn: html [
135 Removed:
136 Removed: html buttonGroup: [
137 Removed: html formButton
138 Removed: beSubmit;
139 Removed: bePrimary;
140 Removed: callback: [ self answer: exercises ];
141 Removed: with: (completion ifNil: [ 'Submit' ] ifNotNil: [ 'Next' ]).
142 Removed: html formButton
143 Removed: beSubmit;
144 Removed: beSecondary;
145 Removed: callback: [ self answer: OrderedCollection new ];
146 Removed: with: (completion ifNil: [ 'Cancel' ] ifNotNil: [ 'Skip' ]) ]
147 Removed: ]
src/MyFitnessTracker/MFTSQLite3Database.class.st
index f23779f9..175fff19 100644..100644
@@ -122,20 +122,20 @@
122 122 execute:
123 123 'SELECT * FROM Workouts WHERE user_id = ?'
124 124 value: aMFTUser id) rows.
125 Added: workouts := allWorkoutRows collect: [ :row |
126 Added: MFTWorkout newFromDictionary: row asDictionary ].
125 127 allSets := self
126 128 getAllSetsForUser: aMFTUser
127 129 connection: openConnection.
128 Removed:
129 Removed: workouts := allWorkoutRows collect: [ :row |
130 Removed: MFTWorkout newFromDictionary: row asDictionary ].
131 130 (allSets groupedBy: #workoutId) keysAndAllValuesDo: [
132 131 :workoutId
133 132 :workoutSets |
134 133 | workout |
135 134 workout := workouts detect: [ :w | w id = workoutId ].
136 135 (workoutSets groupedBy: #groupId) keysAndAllValuesDo: [ :groupId :sets |
137 Removed: workout addSetGroup: (MFTSetGroup id: groupId sets: sets) ] ].
138 Removed:
136 Added: workout addSetGroup:
137 Added: (MFTSetGroup new sets:
138 Added: (sets collect: [ :set | set groupId: groupId ])) ] ].
139 139 ^ workouts
140 140 ]
141 141
src/MyFitnessTracker/MFTSetGroup.class.st
index 267c1a49..090164c7 100644..100644
@@ -2,21 +2,11 @@
2 2 #name : #MFTSetGroup,
3 3 #superclass : #Object,
4 4 #instVars : [
5 Removed: 'id',
6 5 'sets'
7 6 ],
8 7 #category : #'MyFitnessTracker-Model'
9 8 }
10 9
11 Removed: { #category : #accessing }
12 Removed: MFTSetGroup class >> id: anInteger sets: aMFTSetCollection [
13 Removed:
14 Removed: ^ self new
15 Removed: id: anInteger;
16 Removed: sets: aMFTSetCollection;
17 Removed: yourself
18 Removed: ]
19 Removed:
20 10 { #category : #adding }
21 11 MFTSetGroup >> addSet: aMFTSet [
22 12
@@ -77,18 +67,6 @@
77 67 MFTSetGroup >> hasVolume [
78 68
79 69 ^ sets anySatisfy: #hasVolume
80 Removed: ]
81 Removed:
82 Removed: { #category : #accessing }
83 Removed: MFTSetGroup >> id [
84 Removed:
85 Removed: ^ id
86 Removed: ]
87 Removed:
88 Removed: { #category : #accessing }
89 Removed: MFTSetGroup >> id: anObject [
90 Removed:
91 Removed: id := anObject
92 70 ]
93 71
94 72 { #category : #initialization }
src/MyFitnessTracker/MFTSetGroupDialog.class.st
index f89ade77..c6a1b570 100644..100644
@@ -10,11 +10,12 @@
10 10 }
11 11
12 12 { #category : #actions }
13 Removed: MFTSetGroupDialog class >> edit: aMFTSetGroup [
13 Added: MFTSetGroupDialog class >> edit: aMFTSetGroup [
14 14
15 15 ^ self new
16 16 setGroup: aMFTSetGroup;
17 Removed: selectedExercises: (aMFTSetGroup sets collect: #exercise);
17 Added: selectedExercises:
18 Added: (aMFTSetGroup sets collect: #exercise) asSet asOrderedCollection;
18 19 action: #edit;
19 20 yourself
20 21 ]
src/MyFitnessTracker/MFTWorkout.class.st
index de5d97f6..5943c632 100644..100644
@@ -195,7 +195,7 @@
195 195 html tableRow: [
196 196 html tableData
197 197 style: 'text-align: right';
198 Removed: with: set reps asString.
198 Added: with: set reps asString, ' number: ', set number asString, ' groupId: ', set groupId asString.
199 199 renderLoad ifTrue: [
200 200 html tableData
201 201 style: 'text-align: right';
@@ -298,7 +298,7 @@
298 298 groups := OrderedCollection new.
299 299 (aMFTSetCollection groupedBy: #groupId) keysAndValuesDo: [
300 300 :groupId
301 Removed: :sets | groups add: (MFTSetGroup id: groupId sets: sets) ].
301 Added: :sets | groups add: (MFTSetGroup new sets: sets) ].
302 302 self setGroups: groups
303 303 ]
304 304
src/MyFitnessTracker/MFTWorkoutTask.class.st
index a13a69be..cba55ca7 100644..100644
@@ -63,8 +63,7 @@
63 63 action: action;
64 64 component: workout))
65 65 ifTrue: [
66 Removed: self populateMissingSetGroupsAttributes.
67 Removed: self halt.
66 Added: self updateSetsAttributes.
68 67 self answer: workout ]
69 68 ifFalse: [ self answer: nil ]
70 69 ]
@@ -78,7 +77,7 @@
78 77 ]
79 78
80 79 { #category : #'as yet unclassified' }
81 Removed: MFTWorkoutTask >> populateMissingSetGroupsAttributes [
80 Added: MFTWorkoutTask >> updateSetsAttributes [
82 81
83 82 workout setGroups doWithIndex: [ :setGroup :i |
84 83 setGroup sets doWithIndex: [ :set :j |