[Pharo] Personal fitness tracker web app.
Only include Object children in MyFitnessTracker package.
All SBSComponent and other WA- children shall reside under the MyFitnessTracker-Components package.
Changed files
- src/MyFitnessTracker-Components/MFTMuscleGroupComponent.class.st
- src/MyFitnessTracker-Components/MFTUserComponent.class.st
- src/MyFitnessTracker-Components/MFTWorkoutComponent.class.st
- src/MyFitnessTracker/MFTMuscleGroup.class.st
- src/MyFitnessTracker/MFTUser.class.st
- src/MyFitnessTracker/MFTWorkout.class.st
- src/MyFitnessTracker/MFTWorkoutPlan.class.st
src/MyFitnessTracker-Components/MFTMuscleGroupComponent.class.st
@@ -0,0 +1,63 @@
1
Added:
Class {
2
Added:
#name : 'MFTMuscleGroupComponent',
3
Added:
#superclass : 'SBSComponent',
4
Added:
#instVars : [
5
Added:
'muscleGroup'
6
Added:
],
7
Added:
#category : 'MyFitnessTracker-Components',
8
Added:
#package : 'MyFitnessTracker-Components'
9
Added:
}
10
Added:
11
Added:
{ #category : 'as yet unclassified' }
12
Added:
MFTMuscleGroupComponent class >> antagonistIds [
13
Added:
"TODO: is this sufficiently robust ?"
14
Added:
15
Added:
^ {
16
Added:
{ 2. 4 } asSet.
17
Added:
{ 5. 6 } asSet.
18
Added:
{ 8. 9 } asSet.
19
Added:
{ 8. 11 } asSet.
20
Added:
{ 12. 13 } asSet }
21
Added:
]
22
Added:
23
Added:
{ #category : 'instance creation' }
24
Added:
MFTMuscleGroupComponent class >> newFromDictionary: aDictionary [
25
Added:
26
Added:
| id |
27
Added:
id := aDictionary at: 'id'.
28
Added:
29
Added:
^ self new
30
Added:
id: id;
31
Added:
englishName: (aDictionary at: 'english_name');
32
Added:
frenchName: (aDictionary at: 'french_name');
33
Added:
function: (aDictionary at: 'function');
34
Added:
muscles: (MFTSQLite3Database allMuscles select: [ :each |
35
Added:
each primaryMuscleGroupId = id ]);
36
Added:
yourself
37
Added:
]
38
Added:
39
Added:
{ #category : 'initialization' }
40
Added:
MFTMuscleGroupComponent >> initialize [
41
Added:
42
Added:
super initialize.
43
Added:
muscleGroup := MFTMuscleGroup new
44
Added:
]
45
Added:
46
Added:
{ #category : 'as yet unclassified' }
47
Added:
MFTMuscleGroupComponent >> renderContentOn: html [
48
Added:
49
Added:
html heading level2 with: muscleGroup englishName capitalized.
50
Added:
muscleGroup function ifNotNil: [
51
Added:
html
52
Added:
text: ('This muscle group {1}.' format: { muscleGroup function });
53
Added:
break ].
54
Added:
muscleGroup muscles ifNotEmpty: [
55
Added:
html listGroup: [
56
Added:
muscleGroup muscles do: [ :muscle |
57
Added:
html listGroupItem: [
58
Added:
html anchor
59
Added:
url: muscle linkTerminologiaAnatomica;
60
Added:
with: muscle latinName.
61
Added:
muscle function ifNotNil: [
62
Added:
html text: (': {1}.' format: { muscle function }) ] ] ] ] ]
63
Added:
]
src/MyFitnessTracker-Components/MFTUserComponent.class.st
@@ -0,0 +1,41 @@
1
Added:
Class {
2
Added:
#name : 'MFTUserComponent',
3
Added:
#superclass : 'SBSComponent',
4
Added:
#instVars : [
5
Added:
'user'
6
Added:
],
7
Added:
#category : 'MyFitnessTracker-Components',
8
Added:
#package : 'MyFitnessTracker-Components'
9
Added:
}
10
Added:
11
Added:
{ #category : 'initialization' }
12
Added:
MFTUserComponent >> initialize [
13
Added:
14
Added:
super initialize.
15
Added:
user := MFTUser new
16
Added:
]
17
Added:
18
Added:
{ #category : 'rendering' }
19
Added:
MFTUserComponent >> renderContentOn: html [
20
Added:
21
Added:
html table
22
Added:
class: 'table table-bordered my-3';
23
Added:
with: [
24
Added:
html tableRow: [
25
Added:
html tableData: 'username'.
26
Added:
html tableData: user username ].
27
Added:
html tableRow: [
28
Added:
html tableData: 'date of birth'.
29
Added:
html tableData: user dateOfBirth ].
30
Added:
user realFirstName ifNotEmpty: [
31
Added:
html tableRow: [
32
Added:
html tableData: 'real first name'.
33
Added:
html tableData: user realFirstName ] ].
34
Added:
user realLastName ifNotEmpty: [
35
Added:
html tableRow: [
36
Added:
html tableData: 'real last name'.
37
Added:
html tableData: user realLastName ] ].
38
Added:
html tableRow: [
39
Added:
html tableData: 'last login date and time'.
40
Added:
html tableData: user lastLoginDateAndTime ] ]
41
Added:
]
src/MyFitnessTracker-Components/MFTWorkoutComponent.class.st
@@ -0,0 +1,124 @@
1
Added:
Class {
2
Added:
#name : 'MFTWorkoutComponent',
3
Added:
#superclass : 'SBSComponent',
4
Added:
#instVars : [
5
Added:
'workout'
6
Added:
],
7
Added:
#category : 'MyFitnessTracker-Components',
8
Added:
#package : 'MyFitnessTracker-Components'
9
Added:
}
10
Added:
11
Added:
{ #category : 'initialization' }
12
Added:
MFTWorkoutComponent >> initialize [
13
Added:
14
Added:
super initialize.
15
Added:
workout := MFTWorkout new
16
Added:
]
17
Added:
18
Added:
{ #category : 'as yet unclassified' }
19
Added:
MFTWorkoutComponent >> renderContentOn: html [
20
Added:
21
Added:
html definitionList: [
22
Added:
html
23
Added:
definitionTerm: 'Date';
24
Added:
definitionData: workout date.
25
Added:
workout primaryMuscleGroupId ifNotNil: [
26
Added:
html
27
Added:
definitionTerm: 'Primary Muscle Group';
28
Added:
definitionData: self primaryMuscleGroup englishName ].
29
Added:
workout secondaryMuscleGroupIds ifNotEmpty: [
30
Added:
html
31
Added:
definitionTerm: 'Secondary Muscle Group';
32
Added:
definitionData:
33
Added:
(self secondaryMuscleGroups collect: #englishName) asCommaString ] ].
34
Added:
self renderSetGroupsTableOn: html
35
Added:
]
36
Added:
37
Added:
{ #category : 'as yet unclassified' }
38
Added:
MFTWorkoutComponent >> renderSetGroupRowsOn: html [
39
Added:
40
Added:
| renderSetGroupsType renderLoad renderVolume |
41
Added:
"No need to render the type of set group, if it is regular."
42
Added:
renderSetGroupsType := workout allSetGroupsAreRegular not.
43
Added:
renderLoad := workout anySetHasLoad.
44
Added:
renderVolume := workout anySetHasVolume.
45
Added:
46
Added:
workout setGroups do: [ :group |
47
Added:
| setsGroupedByExercise |
48
Added:
setsGroupedByExercise := group sets groupedBy: #exercise.
49
Added:
renderSetGroupsType ifTrue: [
50
Added:
html tableRow: [ "This heading spans the amount of sets for this group + the amount of exercises + 1."
51
Added:
html tableHeading
52
Added:
attributeAt: 'rowspan'
53
Added:
put: group sets size + setsGroupedByExercise keys size + 1;
54
Added:
style: 'vertical-align: middle';
55
Added:
with: [ html text: group description capitalized ] ] ].
56
Added:
setsGroupedByExercise keysAndValuesDo: [ :exercise :sets |
57
Added:
html tableRow: [ "This cell spans the amount of sets for a given exercise."
58
Added:
html tableData
59
Added:
attributeAt: 'rowspan' put: sets size + 1;
60
Added:
style: 'vertical-align: middle';
61
Added:
with: exercise englishName capitalized ].
62
Added:
sets do: [ :set |
63
Added:
html tableRow: [
64
Added:
html tableData
65
Added:
style: 'text-align: right';
66
Added:
with: set reps asString. ", ' number: ', set number asString, ' groupId: ', set groupId asString"
67
Added:
renderLoad ifTrue: [
68
Added:
html tableData
69
Added:
style: 'text-align: right';
70
Added:
with: set load ].
71
Added:
renderVolume ifTrue: [
72
Added:
html tableData
73
Added:
style: 'text-align: right';
74
Added:
with: set volume ] ] ] ] ]
75
Added:
]
76
Added:
77
Added:
{ #category : 'as yet unclassified' }
78
Added:
MFTWorkoutComponent >> renderSetGroupsTableFooterOn: html [
79
Added:
80
Added:
| totalReps |
81
Added:
totalReps := (self sets collect: #reps) sum.
82
Added:
html tableFoot: [
83
Added:
self anySetGroupIsIrregular ifTrue: [ html tableHeading ].
84
Added:
html tableData: 'Total'.
85
Added:
html tableData
86
Added:
style: 'text-align: right';
87
Added:
with: totalReps.
88
Added:
self anySetHasLoad ifTrue: [ html tableData ].
89
Added:
self volume ~~ 0 ifTrue: [
90
Added:
html tableData
91
Added:
style: 'text-align: right';
92
Added:
with: self volume ] ]
93
Added:
]
94
Added:
95
Added:
{ #category : 'as yet unclassified' }
96
Added:
MFTWorkoutComponent >> renderSetGroupsTableHeaderOn: html [
97
Added:
98
Added:
html tableHead: [
99
Added:
self allSetGroupsAreRegular ifFalse: [ html tableHeading ].
100
Added:
html tableHeading: 'Exercise'.
101
Added:
html tableHeading
102
Added:
style: 'text-align: right';
103
Added:
with: 'Reps'.
104
Added:
self anySetHasLoad ifTrue: [
105
Added:
html tableHeading
106
Added:
style: 'text-align: right';
107
Added:
with: 'Load' ].
108
Added:
self anySetHasVolume ifTrue: [
109
Added:
html tableHeading
110
Added:
style: 'text-align: right';
111
Added:
with: 'Volume' ] ]
112
Added:
]
113
Added:
114
Added:
{ #category : 'as yet unclassified' }
115
Added:
MFTWorkoutComponent >> renderSetGroupsTableOn: html [
116
Added:
117
Added:
workout setGroups ifNotEmpty: [
118
Added:
html table
119
Added:
class: 'table table-bordered';
120
Added:
with: [
121
Added:
self renderSetGroupsTableHeaderOn: html.
122
Added:
self renderSetGroupRowsOn: html.
123
Added:
self renderSetGroupsTableFooterOn: html ] ]
124
Added:
]
src/MyFitnessTracker/MFTMuscleGroup.class.st
@@ -1,6 +1,6 @@
1
1
Class {
2
2
#name : 'MFTMuscleGroup',
3
Removed:
#superclass : 'SBSComponent',
3
Added:
#superclass : 'Object',
4
4
#instVars : [
5
5
'id',
6
6
'englishName',
@@ -41,55 +41,55 @@
41
41
yourself
42
42
]
43
43
44
Removed:
{ #category : 'accessing' }
44
Added:
{ #category : 'as yet unclassified' }
45
45
MFTMuscleGroup >> englishName [
46
46
47
47
^ englishName
48
48
]
49
49
50
Removed:
{ #category : 'accessing' }
50
Added:
{ #category : 'as yet unclassified' }
51
51
MFTMuscleGroup >> englishName: aString [
52
52
53
53
englishName := aString
54
54
]
55
55
56
Removed:
{ #category : 'accessing' }
56
Added:
{ #category : 'as yet unclassified' }
57
57
MFTMuscleGroup >> frenchName [
58
58
59
59
^ frenchName
60
60
]
61
61
62
Removed:
{ #category : 'accessing' }
62
Added:
{ #category : 'as yet unclassified' }
63
63
MFTMuscleGroup >> frenchName: anObject [
64
64
65
65
frenchName := anObject
66
66
]
67
67
68
Removed:
{ #category : 'accessing' }
68
Added:
{ #category : 'as yet unclassified' }
69
69
MFTMuscleGroup >> function [
70
70
71
71
^ function
72
72
]
73
73
74
Removed:
{ #category : 'accessing' }
74
Added:
{ #category : 'as yet unclassified' }
75
75
MFTMuscleGroup >> function: anObject [
76
76
77
77
function := anObject
78
78
]
79
79
80
Removed:
{ #category : 'accessing' }
80
Added:
{ #category : 'as yet unclassified' }
81
81
MFTMuscleGroup >> id [
82
82
83
83
^ id
84
84
]
85
85
86
Removed:
{ #category : 'accessing' }
86
Added:
{ #category : 'as yet unclassified' }
87
87
MFTMuscleGroup >> id: anObject [
88
88
89
89
id := anObject
90
90
]
91
91
92
Removed:
{ #category : 'initialization' }
92
Added:
{ #category : 'as yet unclassified' }
93
93
MFTMuscleGroup >> initialize [
94
94
95
95
super initialize.
@@ -99,33 +99,14 @@
99
99
muscles := OrderedCollection new
100
100
]
101
101
102
Removed:
{ #category : 'accessing' }
102
Added:
{ #category : 'as yet unclassified' }
103
103
MFTMuscleGroup >> muscles [
104
104
105
105
^ muscles
106
106
]
107
107
108
Removed:
{ #category : 'accessing' }
108
Added:
{ #category : 'as yet unclassified' }
109
109
MFTMuscleGroup >> muscles: anObject [
110
110
111
111
muscles := anObject
112
Removed:
]
113
Removed:
114
Removed:
{ #category : 'rendering' }
115
Removed:
MFTMuscleGroup >> renderContentOn: html [
116
Removed:
117
Removed:
html heading level2 with: englishName capitalized.
118
Removed:
function ifNotNil: [
119
Removed:
html
120
Removed:
text: ('This muscle group {1}.' format: { function });
121
Removed:
break ].
122
Removed:
muscles ifNotEmpty: [
123
Removed:
html listGroup: [
124
Removed:
muscles do: [ :muscle |
125
Removed:
html listGroupItem: [
126
Removed:
html anchor
127
Removed:
url: muscle linkTerminologiaAnatomica;
128
Removed:
with: muscle latinName.
129
Removed:
muscle function ifNotNil: [
130
Removed:
html text: (': {1}.' format: { muscle function }) ] ] ] ] ]
131
112
]
src/MyFitnessTracker/MFTUser.class.st
@@ -1,6 +1,6 @@
1
1
Class {
2
2
#name : 'MFTUser',
3
Removed:
#superclass : 'SBSComponent',
3
Added:
#superclass : 'Object',
4
4
#instVars : [
5
5
'id',
6
6
'username',
@@ -31,7 +31,7 @@
31
31
^ 6
32
32
]
33
33
34
Removed:
{ #category : 'instance creation' }
34
Added:
{ #category : 'as yet unclassified' }
35
35
MFTUser class >> newDefault [
36
36
37
37
^ self new
@@ -44,7 +44,7 @@
44
44
weights: MFTWeight placeholderCollection
45
45
]
46
46
47
Removed:
{ #category : 'instance creation' }
47
Added:
{ #category : 'as yet unclassified' }
48
48
MFTUser class >> newFromDictionary: aDictionary [
49
49
50
50
^ self new
@@ -60,13 +60,13 @@
60
60
yourself
61
61
]
62
62
63
Removed:
{ #category : 'accessing' }
63
Added:
{ #category : 'as yet unclassified' }
64
64
MFTUser >> accountRegisterDateAndTime [
65
65
66
66
^ accountRegisterDateAndTime
67
67
]
68
68
69
Removed:
{ #category : 'accessing' }
69
Added:
{ #category : 'as yet unclassified' }
70
70
MFTUser >> accountRegisterDateAndTime: anObject [
71
71
72
72
accountRegisterDateAndTime := anObject
@@ -83,31 +83,31 @@
83
83
('last login date and time' -> lastLoginDateAndTime) }
84
84
]
85
85
86
Removed:
{ #category : 'accessing' }
86
Added:
{ #category : 'as yet unclassified' }
87
87
MFTUser >> dateOfBirth [
88
88
89
89
^ dateOfBirth ifNil: [ Date today ]
90
90
]
91
91
92
Removed:
{ #category : 'accessing' }
92
Added:
{ #category : 'as yet unclassified' }
93
93
MFTUser >> dateOfBirth: aDate [
94
94
95
95
dateOfBirth := aDate
96
96
]
97
97
98
Removed:
{ #category : 'accessing' }
98
Added:
{ #category : 'as yet unclassified' }
99
99
MFTUser >> id [
100
100
101
101
^ id
102
102
]
103
103
104
Removed:
{ #category : 'accessing' }
104
Added:
{ #category : 'as yet unclassified' }
105
105
MFTUser >> id: anObject [
106
106
107
107
id := anObject
108
108
]
109
109
110
Removed:
{ #category : 'initialization' }
110
Added:
{ #category : 'as yet unclassified' }
111
111
MFTUser >> initialize [
112
112
113
113
super initialize.
@@ -122,110 +122,85 @@
122
122
weights := OrderedCollection new
123
123
]
124
124
125
Removed:
{ #category : 'accessing' }
125
Added:
{ #category : 'as yet unclassified' }
126
126
MFTUser >> isLoggedIn [
127
127
128
128
^ isLoggedIn
129
129
]
130
130
131
Removed:
{ #category : 'accessing' }
131
Added:
{ #category : 'as yet unclassified' }
132
132
MFTUser >> isLoggedIn: aBoolean [
133
133
134
134
isLoggedIn := aBoolean
135
135
]
136
136
137
Removed:
{ #category : 'accessing' }
137
Added:
{ #category : 'as yet unclassified' }
138
138
MFTUser >> lastLoginDateAndTime [
139
139
140
140
^ lastLoginDateAndTime
141
141
]
142
142
143
Removed:
{ #category : 'accessing' }
143
Added:
{ #category : 'as yet unclassified' }
144
144
MFTUser >> lastLoginDateAndTime: aDateAndTime [
145
145
146
146
lastLoginDateAndTime := aDateAndTime
147
147
]
148
148
149
Removed:
{ #category : 'accessing' }
149
Added:
{ #category : 'as yet unclassified' }
150
150
MFTUser >> passwordHash [
151
151
152
152
^ passwordHash
153
153
]
154
154
155
Removed:
{ #category : 'accessing' }
155
Added:
{ #category : 'as yet unclassified' }
156
156
MFTUser >> passwordHash: aByteArray [
157
157
158
158
passwordHash := aByteArray
159
159
]
160
160
161
Removed:
{ #category : 'accessing' }
161
Added:
{ #category : 'as yet unclassified' }
162
162
MFTUser >> passwordHashFromString: aString [
163
163
164
164
passwordHash := SHA256 new hashMessage: aString
165
165
]
166
166
167
Removed:
{ #category : 'accessing' }
167
Added:
{ #category : 'as yet unclassified' }
168
168
MFTUser >> realFirstName [
169
169
170
170
^ realFirstName
171
171
]
172
172
173
Removed:
{ #category : 'accessing' }
173
Added:
{ #category : 'as yet unclassified' }
174
174
MFTUser >> realFirstName: aString [
175
175
176
176
realFirstName := aString
177
177
]
178
178
179
Removed:
{ #category : 'accessing' }
179
Added:
{ #category : 'as yet unclassified' }
180
180
MFTUser >> realLastName [
181
181
182
182
^ realLastName
183
183
]
184
184
185
Removed:
{ #category : 'accessing' }
185
Added:
{ #category : 'as yet unclassified' }
186
186
MFTUser >> realLastName: aString [
187
187
188
188
realLastName := aString
189
189
]
190
190
191
Removed:
{ #category : 'rendering' }
192
Removed:
MFTUser >> renderContentOn: html [
193
Removed:
194
Removed:
html table
195
Removed:
class: 'table table-bordered my-3';
196
Removed:
with: [
197
Removed:
html tableRow: [
198
Removed:
html tableData: 'username'.
199
Removed:
html tableData: username ].
200
Removed:
html tableRow: [
201
Removed:
html tableData: 'date of birth'.
202
Removed:
html tableData: dateOfBirth ].
203
Removed:
realFirstName ifNotEmpty: [
204
Removed:
html tableRow: [
205
Removed:
html tableData: 'real first name'.
206
Removed:
html tableData: realFirstName ] ].
207
Removed:
realLastName ifNotEmpty: [
208
Removed:
html tableRow: [
209
Removed:
html tableData: 'real last name'.
210
Removed:
html tableData: realLastName ] ].
211
Removed:
html tableRow: [
212
Removed:
html tableData: 'last login date and time'.
213
Removed:
html tableData: lastLoginDateAndTime ] ]
214
Removed:
]
215
Removed:
216
Removed:
{ #category : 'accessing' }
191
Added:
{ #category : 'as yet unclassified' }
217
192
MFTUser >> username [
218
193
219
194
^ username
220
195
]
221
196
222
Removed:
{ #category : 'accessing' }
197
Added:
{ #category : 'as yet unclassified' }
223
198
MFTUser >> username: aString [
224
199
225
200
username := aString
226
201
]
227
202
228
Removed:
{ #category : 'accessing' }
203
Added:
{ #category : 'as yet unclassified' }
229
204
MFTUser >> weights [
230
205
231
206
^ self session user isLoggedIn
@@ -233,13 +208,13 @@
233
208
ifFalse: [ weights ]
234
209
]
235
210
236
Removed:
{ #category : 'accessing' }
211
Added:
{ #category : 'as yet unclassified' }
237
212
MFTUser >> weights: aMFTWeightCollection [
238
213
239
214
weights := aMFTWeightCollection
240
215
]
241
216
242
Removed:
{ #category : 'accessing' }
217
Added:
{ #category : 'as yet unclassified' }
243
218
MFTUser >> workouts [
244
219
245
220
^ self session user isLoggedIn
@@ -247,7 +222,7 @@
247
222
ifFalse: [ workouts ]
248
223
]
249
224
250
Removed:
{ #category : 'accessing' }
225
Added:
{ #category : 'as yet unclassified' }
251
226
MFTUser >> workouts: aMFTWorkoutCollection [
252
227
253
228
workouts := aMFTWorkoutCollection
src/MyFitnessTracker/MFTWorkout.class.st
@@ -1,6 +1,6 @@
1
1
Class {
2
2
#name : 'MFTWorkout',
3
Removed:
#superclass : 'SBSComponent',
3
Added:
#superclass : 'Object',
4
4
#instVars : [
5
5
'id',
6
6
'userId',
@@ -14,7 +14,7 @@
14
14
#tag : 'Model'
15
15
}
16
16
17
Removed:
{ #category : 'instance creation' }
17
Added:
{ #category : 'as yet unclassified' }
18
18
MFTWorkout class >> newFromDictionary: aDictionary [
19
19
20
20
^ self new
@@ -59,13 +59,13 @@
59
59
workout3 }
60
60
]
61
61
62
Removed:
{ #category : 'adding' }
62
Added:
{ #category : 'as yet unclassified' }
63
63
MFTWorkout >> addSetGroup: aMFTSetGroup [
64
64
65
65
setGroups add: aMFTSetGroup
66
66
]
67
67
68
Removed:
{ #category : 'adding' }
68
Added:
{ #category : 'as yet unclassified' }
69
69
MFTWorkout >> addSetGroups: aMFTSetGroupCollection [
70
70
71
71
aMFTSetGroupCollection do: [ :setGroup | setGroups add: setGroup ]
@@ -95,12 +95,12 @@
95
95
^ self sets anySatisfy: #hasVolume
96
96
]
97
97
98
Removed:
{ #category : 'accessing' }
98
Added:
{ #category : 'as yet unclassified' }
99
99
MFTWorkout >> date [
100
100
^ date
101
101
]
102
102
103
Removed:
{ #category : 'accessing' }
103
Added:
{ #category : 'as yet unclassified' }
104
104
MFTWorkout >> date: aDate [
105
105
date := aDate
106
106
]
@@ -116,13 +116,13 @@
116
116
(groupedByMuscle at: muscle) size ]
117
117
]
118
118
119
Removed:
{ #category : 'accessing' }
119
Added:
{ #category : 'as yet unclassified' }
120
120
MFTWorkout >> id [
121
121
122
122
^ id
123
123
]
124
124
125
Removed:
{ #category : 'accessing' }
125
Added:
{ #category : 'as yet unclassified' }
126
126
MFTWorkout >> id: anObject [
127
127
128
128
id := anObject
@@ -137,7 +137,7 @@
137
137
secondaryMuscleGroupIds := OrderedCollection new
138
138
]
139
139
140
Removed:
{ #category : 'accessing' }
140
Added:
{ #category : 'as yet unclassified' }
141
141
MFTWorkout >> primaryMuscleGroup [
142
142
143
143
^ MFTSQLite3Database allMuscleGroups
@@ -145,139 +145,31 @@
145
145
ifNone: [ nil ]
146
146
]
147
147
148
Removed:
{ #category : 'accessing' }
148
Added:
{ #category : 'as yet unclassified' }
149
149
MFTWorkout >> primaryMuscleGroup: aMFTMuscleGroup [
150
150
151
151
primaryMuscleGroupId := aMFTMuscleGroup id
152
152
]
153
153
154
Removed:
{ #category : 'accessing' }
154
Added:
{ #category : 'as yet unclassified' }
155
155
MFTWorkout >> primaryMuscleGroupId [
156
156
157
157
^ primaryMuscleGroupId
158
158
]
159
159
160
Removed:
{ #category : 'accessing' }
160
Added:
{ #category : 'as yet unclassified' }
161
161
MFTWorkout >> primaryMuscleGroupId: anInteger [
162
162
163
163
primaryMuscleGroupId := anInteger
164
164
]
165
165
166
Removed:
{ #category : 'rendering' }
167
Removed:
MFTWorkout >> renderContentOn: html [
168
Removed:
169
Removed:
html definitionList: [
170
Removed:
html
171
Removed:
definitionTerm: 'Date';
172
Removed:
definitionData: date.
173
Removed:
primaryMuscleGroupId ifNotNil: [
174
Removed:
html
175
Removed:
definitionTerm: 'Primary Muscle Group';
176
Removed:
definitionData: self primaryMuscleGroup englishName ].
177
Removed:
secondaryMuscleGroupIds ifNotEmpty: [
178
Removed:
html
179
Removed:
definitionTerm: 'Secondary Muscle Group';
180
Removed:
definitionData:
181
Removed:
(self secondaryMuscleGroups collect: #englishName) asCommaString ] ].
182
Removed:
self renderSetGroupsTableOn: html
183
Removed:
]
184
Removed:
185
Removed:
{ #category : 'rendering' }
186
Removed:
MFTWorkout >> renderSetGroupRowsOn: html [
187
Removed:
188
Removed:
| renderSetGroupsType renderLoad renderVolume |
189
Removed:
"No need to render the type of set group, if it is regular."
190
Removed:
renderSetGroupsType := self allSetGroupsAreRegular not.
191
Removed:
renderLoad := self anySetHasLoad.
192
Removed:
renderVolume := self anySetHasVolume.
193
Removed:
194
Removed:
setGroups do: [ :group |
195
Removed:
| setsGroupedByExercise |
196
Removed:
setsGroupedByExercise := group sets groupedBy: #exercise.
197
Removed:
renderSetGroupsType ifTrue: [
198
Removed:
html tableRow: [ "This heading spans the amount of sets for this group + the amount of exercises + 1."
199
Removed:
html tableHeading
200
Removed:
attributeAt: 'rowspan'
201
Removed:
put: group sets size + setsGroupedByExercise keys size + 1;
202
Removed:
style: 'vertical-align: middle';
203
Removed:
with: [ html text: group description capitalized ] ] ].
204
Removed:
setsGroupedByExercise keysAndValuesDo: [ :exercise :sets |
205
Removed:
html tableRow: [ "This cell spans the amount of sets for a given exercise."
206
Removed:
html tableData
207
Removed:
attributeAt: 'rowspan' put: sets size + 1;
208
Removed:
style: 'vertical-align: middle';
209
Removed:
with: exercise englishName capitalized ].
210
Removed:
sets do: [ :set |
211
Removed:
html tableRow: [
212
Removed:
html tableData
213
Removed:
style: 'text-align: right';
214
Removed:
with: set reps asString. ", ' number: ', set number asString, ' groupId: ', set groupId asString"
215
Removed:
renderLoad ifTrue: [
216
Removed:
html tableData
217
Removed:
style: 'text-align: right';
218
Removed:
with: set load ].
219
Removed:
renderVolume ifTrue: [
220
Removed:
html tableData
221
Removed:
style: 'text-align: right';
222
Removed:
with: set volume ] ] ] ] ]
223
Removed:
]
224
Removed:
225
Removed:
{ #category : 'rendering' }
226
Removed:
MFTWorkout >> renderSetGroupsTableFooterOn: html [
227
Removed:
228
Removed:
| totalReps |
229
Removed:
totalReps := (self sets collect: #reps) sum.
230
Removed:
html tableFoot: [
231
Removed:
self anySetGroupIsIrregular ifTrue: [ html tableHeading ].
232
Removed:
html tableData: 'Total'.
233
Removed:
html tableData
234
Removed:
style: 'text-align: right';
235
Removed:
with: totalReps.
236
Removed:
self anySetHasLoad ifTrue: [ html tableData ].
237
Removed:
self volume ~~ 0 ifTrue: [
238
Removed:
html tableData
239
Removed:
style: 'text-align: right';
240
Removed:
with: self volume ] ]
241
Removed:
]
242
Removed:
243
Removed:
{ #category : 'rendering' }
244
Removed:
MFTWorkout >> renderSetGroupsTableHeaderOn: html [
245
Removed:
246
Removed:
html tableHead: [
247
Removed:
self allSetGroupsAreRegular ifFalse: [ html tableHeading ].
248
Removed:
html tableHeading: 'Exercise'.
249
Removed:
html tableHeading
250
Removed:
style: 'text-align: right';
251
Removed:
with: 'Reps'.
252
Removed:
self anySetHasLoad ifTrue: [
253
Removed:
html tableHeading
254
Removed:
style: 'text-align: right';
255
Removed:
with: 'Load' ].
256
Removed:
self anySetHasVolume ifTrue: [
257
Removed:
html tableHeading
258
Removed:
style: 'text-align: right';
259
Removed:
with: 'Volume' ] ]
260
Removed:
]
261
Removed:
262
Removed:
{ #category : 'rendering' }
263
Removed:
MFTWorkout >> renderSetGroupsTableOn: html [
264
Removed:
265
Removed:
setGroups ifNotEmpty: [
266
Removed:
html table
267
Removed:
class: 'table table-bordered';
268
Removed:
with: [
269
Removed:
self renderSetGroupsTableHeaderOn: html.
270
Removed:
self renderSetGroupRowsOn: html.
271
Removed:
self renderSetGroupsTableFooterOn: html ] ]
272
Removed:
]
273
Removed:
274
Removed:
{ #category : 'accessing' }
166
Added:
{ #category : 'as yet unclassified' }
275
167
MFTWorkout >> secondaryMuscleGroupIds [
276
168
277
169
^ secondaryMuscleGroupIds
278
170
]
279
171
280
Removed:
{ #category : 'accessing' }
172
Added:
{ #category : 'as yet unclassified' }
281
173
MFTWorkout >> secondaryMuscleGroupIds: anIntegerCollection [
282
174
283
175
secondaryMuscleGroupIds := anIntegerCollection
@@ -296,25 +188,25 @@
296
188
secondaryMuscleGroupIds := aMFTMuscleGroupCollection collect: #id
297
189
]
298
190
299
Removed:
{ #category : 'accessing' }
191
Added:
{ #category : 'as yet unclassified' }
300
192
MFTWorkout >> setGroups [
301
193
302
194
^ setGroups
303
195
]
304
196
305
Removed:
{ #category : 'accessing' }
197
Added:
{ #category : 'as yet unclassified' }
306
198
MFTWorkout >> setGroups: aMFTSetGroupCollection [
307
199
308
200
setGroups := aMFTSetGroupCollection
309
201
]
310
202
311
Removed:
{ #category : 'accessing' }
203
Added:
{ #category : 'as yet unclassified' }
312
204
MFTWorkout >> sets [
313
205
314
206
^ setGroups flatCollect: #sets
315
207
]
316
208
317
Removed:
{ #category : 'accessing' }
209
Added:
{ #category : 'as yet unclassified' }
318
210
MFTWorkout >> sets: aMFTSetCollection [
319
211
320
212
| groups |
@@ -325,13 +217,13 @@
325
217
self setGroups: groups
326
218
]
327
219
328
Removed:
{ #category : 'accessing' }
220
Added:
{ #category : 'as yet unclassified' }
329
221
MFTWorkout >> userId [
330
222
331
223
^ userId
332
224
]
333
225
334
Removed:
{ #category : 'accessing' }
226
Added:
{ #category : 'as yet unclassified' }
335
227
MFTWorkout >> userId: anObject [
336
228
337
229
userId := anObject
src/MyFitnessTracker/MFTWorkoutPlan.class.st
@@ -1,6 +1,6 @@
1
1
Class {
2
2
#name : 'MFTWorkoutPlan',
3
Removed:
#superclass : 'SBSComponent',
3
Added:
#superclass : 'Object',
4
4
#instVars : [
5
5
'workouts'
6
6
],