[Pharo] Personal fitness tracker web app.
MFTWorkoutTask now working nearly entirely!
Changed files
- src/MyFitnessTracker/MFTSet.class.st
- src/MyFitnessTracker/MFTSetDialog.class.st
- src/MyFitnessTracker/MFTSetGroup.class.st
- src/MyFitnessTracker/MFTSetGroupDialog.class.st
- src/MyFitnessTracker/MFTSetGroupsDialog.class.st
- src/MyFitnessTracker/MFTSetsDialog.class.st
- src/MyFitnessTracker/MFTWorkout.class.st
- src/MyFitnessTracker/MFTWorkoutTask.class.st
src/MyFitnessTracker/MFTSet.class.st
@@ -214,8 +214,9 @@
214
214
{ #category : #accessing }
215
215
MFTSet >> exercise [
216
216
217
Removed:
^ MFTSQLite3Database allExercises detect: [ :exercise |
218
Removed:
exercise id = exerciseId ]
217
Added:
^ MFTSQLite3Database allExercises
218
Added:
detect: [ :exercise | exercise id = exerciseId ]
219
Added:
ifNone: [ MFTExercise new ]
219
220
]
220
221
221
222
{ #category : #accessing }
src/MyFitnessTracker/MFTSetDialog.class.st
@@ -16,6 +16,24 @@
16
16
yourself
17
17
]
18
18
19
Added:
{ #category : #actions }
20
Added:
MFTSetDialog class >> edit: aMFTSet withExercise: aMFTExercise [
21
Added:
22
Added:
^ self new
23
Added:
set: (aMFTSet exercise: aMFTExercise);
24
Added:
action: #edit;
25
Added:
yourself
26
Added:
]
27
Added:
28
Added:
{ #category : #'instance creation' }
29
Added:
MFTSetDialog class >> newForExercise: aMFTExercise [
30
Added:
31
Added:
^ self new
32
Added:
set: (MFTSet new exercise: aMFTExercise);
33
Added:
subheading: aMFTExercise englishName;
34
Added:
yourself
35
Added:
]
36
Added:
19
37
{ #category : #initialization }
20
38
MFTSetDialog >> initialize [
21
39
@@ -40,21 +58,24 @@
40
58
html numberInput formControl
41
59
value: set load;
42
60
callback: [ :value |
43
Removed:
value ifNotEmpty: [ set load: value asNumber ] ] ] ].
61
Added:
set load:
62
Added:
(value ifNotEmpty: [ value asNumber ] ifEmpty: [ nil ]) ] ] ].
44
63
html tableRow: [
45
64
html tableHeading: 'RPE'.
46
65
html tableData: [
47
66
html numberInput formControl
48
67
value: set rpe;
49
68
callback: [ :value |
50
Removed:
value ifNotEmpty: [ set rpe: value asInteger ] ] ] ].
69
Added:
set rpe:
70
Added:
(value ifNotEmpty: [ value asInteger ] ifEmpty: [ nil ]) ] ] ].
51
71
html tableRow: [
52
72
html tableHeading: 'Rest after (s)'.
53
73
html tableData: [
54
74
html numberInput formControl
55
75
value: set restAfter;
56
76
callback: [ :value |
57
Removed:
value ifNotEmpty: [ set restAfter: value asNumber ] ] ] ] ] ]
77
Added:
set restAfter:
78
Added:
(value ifNotEmpty: [ value asNumber ] ifEmpty: [ nil ]) ] ] ] ] ]
58
79
]
59
80
60
81
{ #category : #delegation }
src/MyFitnessTracker/MFTSetGroup.class.st
@@ -23,6 +23,12 @@
23
23
sets add: aMFTSet
24
24
]
25
25
26
Added:
{ #category : #adding }
27
Added:
MFTSetGroup >> addSets: aMFTSetCollection [
28
Added:
29
Added:
sets addAll: aMFTSetCollection
30
Added:
]
31
Added:
26
32
{ #category : #initialization }
27
33
MFTSetGroup >> description [
28
34
@@ -168,6 +174,14 @@
168
174
MFTSetGroup >> updateSet: aMFTSet1 with: aMFTSet2 [
169
175
170
176
sets at: (sets indexOf: aMFTSet1) put: aMFTSet2
177
Added:
]
178
Added:
179
Added:
{ #category : #'as yet unclassified' }
180
Added:
MFTSetGroup >> updateSets: aMFTSetCollection1 with: aMFTSetCollection2 [
181
Added:
182
Added:
aMFTSetCollection1
183
Added:
with: aMFTSetCollection2
184
Added:
do: [ :oldSet :newSet | self updateSet: oldSet with: newSet ]
171
185
]
172
186
173
187
{ #category : #'as yet unclassified' }
src/MyFitnessTracker/MFTSetGroupDialog.class.st
@@ -4,64 +4,83 @@
4
4
#instVars : [
5
5
'allExercises',
6
6
'selectedExercises',
7
Removed:
'setGroups'
7
Added:
'setGroup'
8
8
],
9
9
#category : #'MyFitnessTracker-Dialog'
10
10
}
11
11
12
Added:
{ #category : #actions }
13
Added:
MFTSetGroupDialog class >> edit: aMFTSetGroup [
14
Added:
15
Added:
^ self new
16
Added:
setGroup: aMFTSetGroup;
17
Added:
selectedExercises: (aMFTSetGroup sets collect: #exercise);
18
Added:
action: #edit;
19
Added:
yourself
20
Added:
]
21
Added:
22
Added:
{ #category : #actions }
23
Added:
MFTSetGroupDialog class >> edit: aMFTSetGroup withExercises: aMFTExerciseCollection [
24
Added:
25
Added:
^ self new
26
Added:
setGroup: aMFTSetGroup;
27
Added:
selectedExercises: aMFTExerciseCollection;
28
Added:
action: #edit;
29
Added:
yourself
30
Added:
]
31
Added:
12
32
{ #category : #adding }
13
33
MFTSetGroupDialog >> addSet [
14
34
15
35
| set |
16
Removed:
set := self call: MFTSetDialog new.
36
Added:
set := self call:
37
Added:
(MFTSetDialog newForExercise: selectedExercises first).
17
38
set ifNil: [ ^ self ].
18
Removed:
setGroups ifEmpty: [
19
Removed:
setGroups := OrderedCollection with: MFTSetGroup new ].
20
Removed:
setGroups first addSet: (set exercise: selectedExercises first)
39
Added:
setGroup sets ifEmpty: [ setGroup := MFTSetGroup new ].
40
Added:
setGroup addSet: (set exercise: selectedExercises first)
21
41
]
22
42
23
43
{ #category : #adding }
24
Removed:
MFTSetGroupDialog >> addSetGroup: aMFTExerciseCollection [
44
Added:
MFTSetGroupDialog >> addSets: aMFTExerciseCollection [
25
45
26
46
| sets |
27
47
sets := self call:
28
Removed:
((MFTSetsDialog newForIrregularSetGroup:
48
Added:
((MFTSetsDialog newForExercises:
29
49
aMFTExerciseCollection) subheading:
30
50
((selectedExercises collect: #englishName) joinUsing: '/')).
31
Removed:
sets ifEmpty: [ ^ self ].
32
Removed:
setGroups add: (MFTSetGroup new sets: sets)
51
Added:
sets ifNotEmpty: [ setGroup addSets: sets ]
33
52
]
34
53
35
Removed:
{ #category : #'as yet unclassified' }
36
Removed:
MFTSetGroupDialog >> duplicateSetGroup: aMFTSetGroup [
37
Removed:
38
Removed:
setGroups add: aMFTSetGroup after: aMFTSetGroup
39
Removed:
]
40
Removed:
41
54
{ #category : #actions }
42
Removed:
MFTSetGroupDialog >> edit: aMFTSetGroup [
55
Added:
MFTSetGroupDialog >> editSet: aMFTSet [
43
56
44
Removed:
nil
57
Added:
| oldSet newSet |
58
Added:
oldSet := aMFTSet.
59
Added:
newSet := self call:
60
Added:
(MFTSetDialog
61
Added:
edit: oldSet copy
62
Added:
withExercise: selectedExercises first).
63
Added:
newSet ifNotNil: [ setGroup updateSet: oldSet with: newSet ]
45
64
]
46
65
47
66
{ #category : #actions }
48
Removed:
MFTSetGroupDialog >> editSetGroup: aMFTSetGroup [
67
Added:
MFTSetGroupDialog >> editSets: aMFTSetCollection [
49
68
50
Removed:
| setOrGroup |
51
Removed:
setOrGroup := aMFTSetGroup isRegularSetGroup
52
Removed:
ifTrue: [
53
Removed:
self call: (MFTSetDialog edit: aMFTSetGroup) ]
54
Removed:
ifFalse: [
55
Removed:
self call: (MFTSetsDialog edit: aMFTSetGroup) ]
69
Added:
| oldSets newSets |
70
Added:
oldSets := aMFTSetCollection.
71
Added:
newSets := self call:
72
Added:
(MFTSetsDialog
73
Added:
edit: oldSets copy
74
Added:
withExercises: selectedExercises).
75
Added:
newSets ifNotEmpty: [ setGroup updateSets: oldSets with: newSets ]
56
76
]
57
77
58
78
{ #category : #initialization }
59
79
MFTSetGroupDialog >> initialize [
60
80
61
81
super initialize.
62
Removed:
setGroups := OrderedCollection with:
63
Removed:
(MFTSetGroup new sets:
64
Removed:
(OrderedCollection with: (MFTSet new reps: 8))).
82
Added:
setGroup := MFTSetGroup new sets:
83
Added:
(OrderedCollection with: (MFTSet new reps: 8)).
65
84
allExercises := MFTSQLite3Database allExercises.
66
85
selectedExercises := OrderedCollection with: allExercises first
67
86
]
@@ -72,10 +91,7 @@
72
91
self heading: 'Giant Sets'.
73
92
selectedExercises := OrderedCollection withAll:
74
93
(allExercises copyFrom: 1 to: 5).
75
Removed:
setGroups first sets: (selectedExercises collect: [ :exercise |
76
Removed:
MFTSet new
77
Removed:
reps: 8;
78
Removed:
exercise: exercise ])
94
Added:
self populateSetsForExercises: selectedExercises
79
95
]
80
96
81
97
{ #category : #rendering }
@@ -83,7 +99,7 @@
83
99
84
100
self heading: 'Sets'.
85
101
selectedExercises := OrderedCollection with: allExercises first.
86
Removed:
self populateSetGroupsForExercises: selectedExercises
102
Added:
self populateSetsForExercises: selectedExercises
87
103
]
88
104
89
105
{ #category : #rendering }
@@ -93,7 +109,7 @@
93
109
selectedExercises := OrderedCollection
94
110
with: allExercises first
95
111
with: allExercises second.
96
Removed:
self populateSetGroupsForExercises: selectedExercises
112
Added:
self populateSetsForExercises: selectedExercises
97
113
]
98
114
99
115
{ #category : #rendering }
@@ -104,26 +120,19 @@
104
120
with: allExercises first
105
121
with: allExercises second
106
122
with: allExercises third.
107
Removed:
self populateSetGroupsForExercises: selectedExercises
123
Added:
self populateSetsForExercises: selectedExercises
108
124
]
109
125
110
126
{ #category : #'as yet unclassified' }
111
Removed:
MFTSetGroupDialog >> populateSetGroupsForExercises: aMFTExerciseCollection [
127
Added:
MFTSetGroupDialog >> populateSetsForExercises: aMFTExerciseCollection [
112
128
113
Removed:
setGroups := OrderedCollection with:
114
Removed:
(MFTSetGroup new sets:
115
Removed:
(aMFTExerciseCollection collect: [ :exercise |
116
Removed:
MFTSet new
117
Removed:
reps: 8;
118
Removed:
exercise: exercise ]))
129
Added:
setGroup := MFTSetGroup new sets:
130
Added:
(aMFTExerciseCollection collect: [ :exercise |
131
Added:
MFTSet new
132
Added:
reps: 8;
133
Added:
exercise: exercise ])
119
134
]
120
135
121
Removed:
{ #category : #removing }
122
Removed:
MFTSetGroupDialog >> removeSetGroup: aMFTSetGroup [
123
Removed:
124
Removed:
setGroups remove: aMFTSetGroup
125
Removed:
]
126
Removed:
127
136
{ #category : #rendering }
128
137
MFTSetGroupDialog >> renderConfigureSetGroupButtonsOn: html [
129
138
@@ -136,7 +145,7 @@
136
145
ifFalse: [
137
146
html outlineButton bePrimary beSmall
138
147
class: 'me-2';
139
Removed:
callback: [ self addSetGroup: selectedExercises ];
148
Added:
callback: [ self addSets: selectedExercises ];
140
149
with: 'Add set group' ].
141
150
html buttonGroup: [
142
151
selectedExercises size ~~ 1 ifTrue: [
@@ -163,18 +172,15 @@
163
172
self renderDialogOn: html with: [
164
173
self renderSelectExercisesOn: html.
165
174
html horizontalRule.
166
Removed:
(setGroups collect: #sets) ifNotEmpty: [
167
Removed:
self renderSetGroupTableOn: html ].
175
Added:
setGroup sets ifNotEmpty: [ self renderSetGroupTableOn: html ].
168
176
self renderConfigureSetGroupButtonsOn: html ]
169
177
]
170
178
171
179
{ #category : #rendering }
172
180
MFTSetGroupDialog >> renderSelectExercisesOn: html [
173
Removed:
" selectedExercises := allExercises
174
Removed:
detect: [ :exercise |
175
Removed:
exercise id = selectedExercise id ]
176
Removed:
ifNone: [ allExercises first ]."
177
181
182
Added:
| allSets |
183
Added:
allSets := setGroup sets.
178
184
selectedExercises doWithIndex: [ :selectedExercise :i |
179
185
html formGroup: [
180
186
html label: 'Exercise ' , (selectedExercises size > 1
@@ -183,71 +189,85 @@
183
189
html select formControl
184
190
list: allExercises;
185
191
selected: selectedExercise;
186
Removed:
callback: [ :exercise | selectedExercises at: i put: exercise ];
192
Added:
callback: [ :exercise |
193
Added:
selectedExercises at: i put: exercise.
194
Added:
self updateAllSelectedExercises ];
187
195
labels: [ :each | each englishName ] ] ]
188
196
]
189
197
190
198
{ #category : #rendering }
191
199
MFTSetGroupDialog >> renderSetGroupRowsOn: html [
192
200
193
Removed:
| renderLoad |
194
Removed:
renderLoad := setGroups anySatisfy: #hasLoad.
195
Removed:
setGroups do: [ :group |
196
Removed:
html tableRow with: [
201
Added:
setGroup sets doWithIndex: [ :set :i |
202
Added:
(i - 1 isDivisibleBy: selectedExercises size) ifTrue: [
203
Added:
| selectedSets |
204
Added:
selectedSets := setGroup sets atAll:
205
Added:
(i to: i + selectedExercises size - 1).
206
Added:
html tableRow with: [
207
Added:
html tableData
208
Added:
attributeAt: 'rowspan' put: selectedExercises size + 1;
209
Added:
style: 'vertical-align: middle';
210
Added:
with: [
211
Added:
html buttonGroup: [
212
Added:
html outlineButton
213
Added:
beDanger;
214
Added:
beSmall;
215
Added:
callback: [ setGroup removeSets: selectedSets ];
216
Added:
with: 'Remove'.
217
Added:
html outlineButton
218
Added:
beSecondary;
219
Added:
beSmall;
220
Added:
callback: [
221
Added:
selectedSets size = 1
222
Added:
ifTrue: [ self editSet: selectedSets first ]
223
Added:
ifFalse: [ self editSets: selectedSets ] ];
224
Added:
with: 'Edit'.
225
Added:
selectedExercises size = 1 ifTrue: [
226
Added:
html outlineButton
227
Added:
beSecondary;
228
Added:
beSmall;
229
Added:
callback: [ setGroup duplicateSet: selectedSets first ];
230
Added:
with: 'Duplicate' ] ] ] ] ].
231
Added:
232
Added:
html tableRow: [ "This row spans the amount of sets for a given exercise."
233
Added:
setGroup isIrregularSetGroup ifTrue: [
234
Added:
html tableData with: set exercise englishName capitalized ].
197
235
html tableData
198
Removed:
attributeAt: 'rowspan' put: group sets size + 1;
199
Removed:
style: 'vertical-align: middle';
200
Removed:
with: [
201
Removed:
html buttonGroup: [
202
Removed:
html outlineButton
203
Removed:
beDanger;
204
Removed:
beSmall;
205
Removed:
callback: [ self removeSetGroup: group ];
206
Removed:
with: 'Remove'.
207
Removed:
html outlineButton
208
Removed:
beSecondary;
209
Removed:
beSmall;
210
Removed:
callback: [ self editSetGroup: group ];
211
Removed:
with: 'Edit'.
212
Removed:
html outlineButton
213
Removed:
beSecondary;
214
Removed:
beSmall;
215
Removed:
callback: [ self duplicateSetGroup: group ];
216
Removed:
with: 'Duplicate' ] ] ].
217
Removed:
group sets do: [ :set |
218
Removed:
html tableRow: [ "This row spans the amount of sets for a given exercise."
219
Removed:
group isIrregularSetGroup ifTrue: [
220
Removed:
html tableData with: set exercise englishName capitalized ].
236
Added:
style: 'text-align: right';
237
Added:
with: set reps.
238
Added:
setGroup hasLoad ifTrue: [
221
239
html tableData
222
240
style: 'text-align: right';
223
Removed:
with: set reps.
224
Removed:
renderLoad ifTrue: [
225
Removed:
html tableData
226
Removed:
style: 'text-align: right';
227
Removed:
with: set load ] ] ] ]
241
Added:
with: set load ].
242
Added:
setGroup hasRpe ifTrue: [
243
Added:
html tableData
244
Added:
style: 'text-align: right';
245
Added:
with: set rpe ].
246
Added:
setGroup hasRestAfter ifTrue: [
247
Added:
html tableData
248
Added:
style: 'text-align: right';
249
Added:
with: set restAfter ] ] ]
228
250
]
229
251
230
252
{ #category : #rendering }
231
253
MFTSetGroupDialog >> renderSetGroupTableHeaderOn: html [
232
254
233
Removed:
| allSets |
234
Removed:
allSets := setGroups collect: #sets.
235
255
html tableHead: [
236
256
html tableHeading.
237
Removed:
(setGroups anySatisfy: #isIrregularSetGroup) ifTrue: [
257
Added:
setGroup isIrregularSetGroup ifTrue: [
238
258
html tableHeading with: 'Exercise' ].
239
259
html tableHeading
240
260
style: 'text-align: right';
241
261
with: 'Reps'.
242
Removed:
(setGroups anySatisfy: #hasLoad) ifTrue: [
262
Added:
setGroup hasLoad ifTrue: [
243
263
html tableHeading
244
264
style: 'text-align: right';
245
265
with: 'Load' ].
246
Removed:
(setGroups anySatisfy: #hasRpe) ifTrue: [
266
Added:
setGroup hasRpe ifTrue: [
247
267
html tableHeading
248
268
style: 'text-align: right';
249
269
with: 'RPE' ].
250
Removed:
(setGroups anySatisfy: #hasRestAfter) ifTrue: [
270
Added:
setGroup hasRestAfter ifTrue: [
251
271
html tableHeading
252
272
style: 'text-align: right';
253
273
with: 'Rest After (s)' ] ]
@@ -270,7 +290,7 @@
270
290
html formButton
271
291
beSubmit;
272
292
bePrimary;
273
Removed:
callback: [ self answer: setGroups ];
293
Added:
callback: [ self answer: setGroup ];
274
294
with: (completion ifNil: [ 'Submit' ] ifNotNil: [ 'Next' ]).
275
295
html formButton
276
296
beSubmit;
@@ -292,13 +312,26 @@
292
312
]
293
313
294
314
{ #category : #accessing }
295
Removed:
MFTSetGroupDialog >> setGroups [
315
Added:
MFTSetGroupDialog >> setGroup [
296
316
297
Removed:
^ setGroups
317
Added:
^ setGroup
298
318
]
299
319
300
320
{ #category : #accessing }
301
Removed:
MFTSetGroupDialog >> setGroups: anObject [
321
Added:
MFTSetGroupDialog >> setGroup: anObject [
302
322
303
Removed:
setGroups := anObject
323
Added:
setGroup := anObject
324
Added:
]
325
Added:
326
Added:
{ #category : #'as yet unclassified' }
327
Added:
MFTSetGroupDialog >> updateAllSelectedExercises [
328
Added:
329
Added:
| allSets |
330
Added:
allSets := setGroup sets.
331
Added:
selectedExercises doWithIndex: [ :selectedExercise :i |
332
Added:
i to: allSets size by: selectedExercises size do: [ :j |
333
Added:
| set |
334
Added:
"Update every nth set to reflect the newly selected exercise selectedExercises at: i."
335
Added:
set := allSets at: j.
336
Added:
set exercise: selectedExercise ] ]
304
337
]
src/MyFitnessTracker/MFTSetGroupsDialog.class.st
@@ -7,15 +7,6 @@
7
7
#category : #'MyFitnessTracker-Dialog'
8
8
}
9
9
10
Removed:
{ #category : #actions }
11
Removed:
MFTSetGroupsDialog class >> edit: aMFTSetCollection [
12
Removed:
13
Removed:
^ self new
14
Removed:
sets: aMFTSetCollection;
15
Removed:
action: #edit;
16
Removed:
yourself
17
Removed:
]
18
Removed:
19
10
{ #category : #adding }
20
11
MFTSetGroupsDialog >> addExercise [
21
12
@@ -24,6 +15,16 @@
24
15
setGroup ifNotNil: [ setGroups add: setGroup ]
25
16
]
26
17
18
Added:
{ #category : #rendering }
19
Added:
MFTSetGroupsDialog >> editSetGroup: aMFTSetGroup [
20
Added:
21
Added:
| oldSetGroup newSetGroup |
22
Added:
oldSetGroup := aMFTSetGroup.
23
Added:
newSetGroup := self call: (MFTSetGroupDialog edit: aMFTSetGroup copy).
24
Added:
newSetGroup ifNotNil: [
25
Added:
setGroups at: (setGroups indexOf: oldSetGroup) put: newSetGroup ]
26
Added:
]
27
Added:
27
28
{ #category : #initialization }
28
29
MFTSetGroupsDialog >> initialize [
29
30
@@ -70,20 +71,23 @@
70
71
{ #category : #rendering }
71
72
MFTSetGroupsDialog >> renderSetGroupButtonsOn: html For: setGroup [
72
73
73
Removed:
^ html buttonGroup: [
74
Removed:
html outlineButton
75
Removed:
beDanger;
76
Removed:
beSmall;
77
Removed:
callback: [ setGroups remove: setGroup ];
78
Removed:
with: 'Remove'.
79
Removed:
html outlineButton
80
Removed:
beSecondary;
81
Removed:
beSmall;
82
Removed:
callback: [
83
Removed:
setGroups
84
Removed:
add: setGroup
85
Removed:
afterIndex: (setGroups indexOf: setGroup) ];
86
Removed:
with: 'Duplicate' ]
74
Added:
html buttonGroup: [
75
Added:
html outlineButton
76
Added:
beDanger;
77
Added:
beSmall;
78
Added:
callback: [ setGroups remove: setGroup ];
79
Added:
with: 'Remove'.
80
Added:
html outlineButton
81
Added:
beSecondary;
82
Added:
beSmall;
83
Added:
callback: [ self editSetGroup: setGroup ];
84
Added:
with: 'Edit'.
85
Added:
html outlineButton
86
Added:
beSecondary;
87
Added:
beSmall;
88
Added:
callback: [
89
Added:
setGroups add: setGroup afterIndex: (setGroups indexOf: setGroup) ];
90
Added:
with: 'Duplicate' ]
87
91
]
88
92
89
93
{ #category : #rendering }
@@ -94,16 +98,18 @@
94
98
renderRpe := self renderRpe.
95
99
renderRestAfter := self renderRestAfter.
96
100
setGroups do: [ :setGroup |
97
Removed:
html tableRow
98
Removed:
attributeAt: 'rowspan' put: setGroup sets size + 1;
99
Removed:
with: [
100
Removed:
html tableData: [
101
Removed:
self renderSetGroupButtonsOn: html For: setGroup ] ].
101
Added:
html tableRow with: [
102
Added:
html tableData
103
Added:
attributeAt: 'rowspan' put: setGroup sets size + 1;
104
Added:
style: 'vertical-align: middle';
105
Added:
with: [ self renderSetGroupButtonsOn: html For: setGroup ] ].
102
106
setGroup sets do: [ :set |
103
107
html tableRow: [
104
Removed:
html tableData.
105
108
html tableData: set exercise englishName.
106
Removed:
html tableData: set reps ] ] ]
109
Added:
html tableData: set reps.
110
Added:
setGroup hasLoad ifTrue: [ html tableData: set load ].
111
Added:
setGroup hasRpe ifTrue: [ html tableData: set rpe ].
112
Added:
setGroup hasRestAfter ifTrue: [ html tableData: set restAfter ] ] ] ]
107
113
]
108
114
109
115
{ #category : #rendering }
@@ -136,7 +142,7 @@
136
142
MFTSetGroupsDialog >> renderSetsTableOn: html [
137
143
138
144
html table
139
Removed:
class: 'table table-hover table-bordered';
145
Added:
class: 'table table-bordered';
140
146
with: [
141
147
self renderSetGroupsTableHeaderOn: html.
142
148
self renderSetGroupsRowsOn: html ]
src/MyFitnessTracker/MFTSetsDialog.class.st
@@ -17,9 +17,20 @@
17
17
]
18
18
19
19
{ #category : #actions }
20
Removed:
MFTSetsDialog class >> newForIrregularSetGroup: aMFTExerciseCollection [
20
Added:
MFTSetsDialog class >> edit: aMFTSetCollection withExercises: aMFTExerciseCollection [
21
21
22
22
^ self new
23
Added:
sets: (aMFTSetCollection
24
Added:
with: aMFTExerciseCollection
25
Added:
do: [ :set :exercise | set exercise: exercise ]);
26
Added:
action: #edit;
27
Added:
yourself
28
Added:
]
29
Added:
30
Added:
{ #category : #actions }
31
Added:
MFTSetsDialog class >> newForExercises: aMFTExerciseCollection [
32
Added:
33
Added:
^ self new
23
34
sets: (aMFTExerciseCollection collect: [ :exercise |
24
35
MFTSet new
25
36
reps: 8;
@@ -84,7 +95,7 @@
84
95
html formButton
85
96
beSubmit;
86
97
beSecondary;
87
Removed:
callback: [ self answer: nil ];
98
Added:
callback: [ self answer: OrderedCollection new ];
88
99
with: (completion ifNil: [ 'Cancel' ] ifNotNil: [ 'Skip' ]) ]
89
100
]
90
101
src/MyFitnessTracker/MFTWorkout.class.st
@@ -175,18 +175,18 @@
175
175
renderLoad := self anySetHasLoad.
176
176
renderVolume := self anySetHasVolume.
177
177
178
Removed:
self setGroups do: [ :group |
178
Added:
setGroups do: [ :group |
179
179
| setsGroupedByExercise |
180
180
setsGroupedByExercise := group sets groupedBy: #exercise.
181
181
renderSetGroupsType ifTrue: [
182
Removed:
html tableRow: [ "This row spans the amount of sets for this group + the amount of exercises + 1."
182
Added:
html tableRow: [ "This heading spans the amount of sets for this group + the amount of exercises + 1."
183
183
html tableHeading
184
184
attributeAt: 'rowspan'
185
185
put: group sets size + setsGroupedByExercise keys size + 1;
186
186
style: 'vertical-align: middle';
187
Removed:
with: [ html text: group type capitalized ] ] ].
187
Added:
with: [ html text: group description capitalized ] ] ].
188
188
setsGroupedByExercise keysAndValuesDo: [ :exercise :sets |
189
Removed:
html tableRow: [ "This row spans the amount of sets for a given exercise."
189
Added:
html tableRow: [ "This cell spans the amount of sets for a given exercise."
190
190
html tableData
191
191
attributeAt: 'rowspan' put: sets size + 1;
192
192
style: 'vertical-align: middle';
@@ -195,7 +195,7 @@
195
195
html tableRow: [
196
196
html tableData
197
197
style: 'text-align: right';
198
Removed:
with: set reps.
198
Added:
with: set reps asString.
199
199
renderLoad ifTrue: [
200
200
html tableData
201
201
style: 'text-align: right';
src/MyFitnessTracker/MFTWorkoutTask.class.st
@@ -49,19 +49,23 @@
49
49
workout primaryMuscleGroup;
50
50
completion: 60).
51
51
primaryMuscleGroup ifNotNil: [
52
Removed:
workout primaryMuscleGroupId: primaryMuscleGroup id ].
53
Removed:
secondaryMuscleGroups := self call:
54
Removed:
(MFTSecondaryMuscleGroupsDialog new
55
Removed:
action: action;
56
Removed:
secondaryMuscleGroups:
57
Removed:
workout secondaryMuscleGroups;
58
Removed:
completion: 80).
59
Removed:
workout secondaryMuscleGroupIds: (secondaryMuscleGroups collect: #id).
52
Added:
workout primaryMuscleGroupId: primaryMuscleGroup id.
53
Added:
secondaryMuscleGroups := self call:
54
Added:
(MFTSecondaryMuscleGroupsDialog new
55
Added:
action: action;
56
Added:
secondaryMuscleGroups:
57
Added:
workout secondaryMuscleGroups;
58
Added:
completion: 80).
59
Added:
workout secondaryMuscleGroupIds:
60
Added:
(secondaryMuscleGroups collect: #id) ].
60
61
61
62
(self call: (MFTConfirmDialog new
62
63
action: action;
63
64
component: workout))
64
Removed:
ifTrue: [ self answer: workout ]
65
Added:
ifTrue: [
66
Added:
self populateMissingSetGroupsAttributes.
67
Added:
self halt.
68
Added:
self answer: workout ]
65
69
ifFalse: [ self answer: nil ]
66
70
]
67
71
@@ -71,6 +75,16 @@
71
75
super initialize.
72
76
workout := MFTWorkout new.
73
77
action := #add
78
Added:
]
79
Added:
80
Added:
{ #category : #'as yet unclassified' }
81
Added:
MFTWorkoutTask >> populateMissingSetGroupsAttributes [
82
Added:
83
Added:
workout setGroups doWithIndex: [ :setGroup :i |
84
Added:
setGroup sets doWithIndex: [ :set :j |
85
Added:
set
86
Added:
groupId: i;
87
Added:
number: j ] ]
74
88
]
75
89
76
90
{ #category : #accessing }