[Pharo] Personal fitness tracker web app.
Fix component rendering.
src/MyFitnessTracker-Components/MFTWorkoutComponent.class.st
@@ -8,6 +8,12 @@
8
8
#package : 'MyFitnessTracker-Components'
9
9
}
10
10
11
Added:
{ #category : 'instance creation' }
12
Added:
MFTWorkoutComponent class >> with: aMFTWorkout [
13
Added:
14
Added:
^ self new workout: aMFTWorkout
15
Added:
]
16
Added:
11
17
{ #category : 'initialization' }
12
18
MFTWorkoutComponent >> initialize [
13
19
@@ -20,17 +26,18 @@
20
26
21
27
html definitionList: [
22
28
html
23
Removed:
definitionTerm: 'Date';
24
Removed:
definitionData: workout date.
25
Removed:
workout primaryMuscleGroupId ifNotNil: [
29
Added:
definitionTerm: 'Date Planned';
30
Added:
definitionData: workout datePlanned.
31
Added:
workout primaryMuscleGroup ifNotNil: [
26
32
html
27
33
definitionTerm: 'Primary Muscle Group';
28
Removed:
definitionData: self primaryMuscleGroup englishName ].
29
Removed:
workout secondaryMuscleGroupIds ifNotEmpty: [
34
Added:
definitionData: workout primaryMuscleGroup englishName ].
35
Added:
workout secondaryMuscleGroups ifNotEmpty: [
30
36
html
31
37
definitionTerm: 'Secondary Muscle Group';
32
38
definitionData:
33
Removed:
(self secondaryMuscleGroups collect: #englishName) asCommaString ] ].
39
Added:
(workout secondaryMuscleGroups collect: #englishName)
40
Added:
asCommaString ] ].
34
41
self renderSetGroupsTableOn: html
35
42
]
36
43
@@ -78,34 +85,34 @@
78
85
MFTWorkoutComponent >> renderSetGroupsTableFooterOn: html [
79
86
80
87
| totalReps |
81
Removed:
totalReps := (self sets collect: #reps) sum.
88
Added:
totalReps := (workout sets collect: #reps) sum.
82
89
html tableFoot: [
83
Removed:
self anySetGroupIsIrregular ifTrue: [ html tableHeading ].
90
Added:
workout anySetGroupIsIrregular ifTrue: [ html tableHeading ].
84
91
html tableData: 'Total'.
85
92
html tableData
86
93
style: 'text-align: right';
87
94
with: totalReps.
88
Removed:
self anySetHasLoad ifTrue: [ html tableData ].
89
Removed:
self volume ~~ 0 ifTrue: [
95
Added:
workout anySetHasLoad ifTrue: [ html tableData ].
96
Added:
workout volume ~~ 0 ifTrue: [
90
97
html tableData
91
98
style: 'text-align: right';
92
Removed:
with: self volume ] ]
99
Added:
with: workout volume ] ]
93
100
]
94
101
95
102
{ #category : 'as yet unclassified' }
96
103
MFTWorkoutComponent >> renderSetGroupsTableHeaderOn: html [
97
104
98
105
html tableHead: [
99
Removed:
self allSetGroupsAreRegular ifFalse: [ html tableHeading ].
106
Added:
workout allSetGroupsAreRegular ifFalse: [ html tableHeading ].
100
107
html tableHeading: 'Exercise'.
101
108
html tableHeading
102
109
style: 'text-align: right';
103
110
with: 'Reps'.
104
Removed:
self anySetHasLoad ifTrue: [
111
Added:
workout anySetHasLoad ifTrue: [
105
112
html tableHeading
106
113
style: 'text-align: right';
107
114
with: 'Load' ].
108
Removed:
self anySetHasVolume ifTrue: [
115
Added:
workout anySetHasVolume ifTrue: [
109
116
html tableHeading
110
117
style: 'text-align: right';
111
118
with: 'Volume' ] ]
@@ -121,4 +128,16 @@
121
128
self renderSetGroupsTableHeaderOn: html.
122
129
self renderSetGroupRowsOn: html.
123
130
self renderSetGroupsTableFooterOn: html ] ]
131
Added:
]
132
Added:
133
Added:
{ #category : 'accessing' }
134
Added:
MFTWorkoutComponent >> workout [
135
Added:
136
Added:
^ workout
137
Added:
]
138
Added:
139
Added:
{ #category : 'accessing' }
140
Added:
MFTWorkoutComponent >> workout: anObject [
141
Added:
142
Added:
workout := anObject
124
143
]