[Pharo] Personal fitness tracker web app.
Update everything.
Let's stabilize the core domain objects soon and start dogfooding ASAP.
Changed files
- src/MyFitnessTracker-Core/MFTMuscleGroup.class.st
- src/MyFitnessTracker-Core/MFTPlan.class.st
- src/MyFitnessTracker-Core/MFTRoutine.class.st
- src/MyFitnessTracker-Core/MFTSetGroupPrescription.class.st
- src/MyFitnessTracker-Core/MFTSetLog.class.st
- src/MyFitnessTracker-Core/MFTTrainee.class.st
- src/MyFitnessTracker-Core/MFTWorkoutLog.class.st
- src/MyFitnessTracker-Core/MFTWorkoutLogBook.class.st
- src/MyFitnessTracker-Core/MFTWorkoutPrescription.class.st
- src/MyFitnessTracker-Core/ManifestMyFitnessTrackerCore.class.st
- src/MyFitnessTracker-Utils/ManifestMyFitnessTrackerUtils.class.st
- src/MyFitnessTracker-Web/MFTFileLibrary.class.st
- src/MyFitnessTracker-Web/MFTFooterComponent.class.st
- src/MyFitnessTracker-Web/MFTHomePage.class.st
- src/MyFitnessTracker-Web/MFTNavbarComponent.class.st
- src/MyFitnessTracker-Web/MFTPage.class.st
- src/MyFitnessTracker-Web/MFTPlanPage.class.st
- src/MyFitnessTracker-Web/MFTStatusComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutLogComponent.class.st
- src/MyFitnessTracker-Web/MFTWorkoutPrescriptionComponent.class.st
src/MyFitnessTracker-Core/MFTMuscleGroup.class.st
@@ -94,7 +94,7 @@
94
94
]
95
95
96
96
{ #category : 'instance creation' }
97
Removed:
MFTMuscleGroup class >> legs [
97
Added:
MFTMuscleGroup class >> leg [
98
98
99
99
^ self newWithEnglishName
100
100
muscles: {
src/MyFitnessTracker-Core/MFTPlan.class.st
@@ -39,6 +39,12 @@
39
39
ifNil: [ 'plan not started' ]
40
40
]
41
41
42
Added:
{ #category : 'as yet unclassified' }
43
Added:
MFTPlan >> nextWorkout [
44
Added:
45
Added:
^ routine workouts first
46
Added:
]
47
Added:
42
48
{ #category : 'accessing' }
43
49
MFTPlan >> routine [
44
50
@@ -60,7 +66,7 @@
60
66
{ #category : 'accessing' }
61
67
MFTPlan >> start: aDateAndTime [
62
68
63
Removed:
start := aDateAndTime
69
Added:
start := aDateAndTime asDateAndTime
64
70
]
65
71
66
72
{ #category : 'accessing' }
src/MyFitnessTracker-Core/MFTRoutine.class.st
@@ -59,5 +59,5 @@
59
59
{ #category : 'accessing' }
60
60
MFTRoutine >> workouts: aMFTWorkoutPrescriptionCollection [
61
61
62
Removed:
workouts := aMFTWorkoutPrescriptionCollection
62
Added:
workouts := aMFTWorkoutPrescriptionCollection asArray
63
63
]
src/MyFitnessTracker-Core/MFTSetGroupPrescription.class.st
@@ -28,6 +28,12 @@
28
28
sets := OrderedCollection new
29
29
]
30
30
31
Added:
{ #category : 'testing' }
32
Added:
MFTSetGroupPrescription >> setCount [
33
Added:
34
Added:
^ sets size
35
Added:
]
36
Added:
31
37
{ #category : 'accessing' }
32
38
MFTSetGroupPrescription >> sets [
33
39
src/MyFitnessTracker-Core/MFTSetLog.class.st
@@ -7,7 +7,8 @@
7
7
#instVars : [
8
8
'prescription',
9
9
'reps',
10
Removed:
'load'
10
Added:
'load',
11
Added:
'failureAchieved'
11
12
],
12
13
#category : 'MyFitnessTracker-Core-Logging',
13
14
#package : 'MyFitnessTracker-Core',
@@ -34,14 +35,35 @@
34
35
{ #category : 'initialization' }
35
36
MFTSetLog >> canonicalName [
36
37
37
Removed:
^ reps asString , '×' , load asString , ' '
38
Removed:
, prescription exercise canonicalName
38
Added:
^ self isLogged
39
Added:
ifTrue: [
40
Added:
reps asString , '×' , load asString , ' '
41
Added:
, prescription exercise canonicalName ]
42
Added:
ifFalse: [ 'unlogged set' ]
39
43
]
40
44
41
45
{ #category : 'accessing' }
42
46
MFTSetLog >> exercise [
43
47
44
48
^ prescription exercise
49
Added:
]
50
Added:
51
Added:
{ #category : 'accessing' }
52
Added:
MFTSetLog >> failureAchieved [
53
Added:
54
Added:
^ failureAchieved
55
Added:
]
56
Added:
57
Added:
{ #category : 'accessing' }
58
Added:
MFTSetLog >> failureAchieved: aBoolean [
59
Added:
60
Added:
failureAchieved := aBoolean
61
Added:
]
62
Added:
63
Added:
{ #category : 'initialization' }
64
Added:
MFTSetLog >> isLogged [
65
Added:
66
Added:
^ reps isNotNil and: [ load isNotNil ]
45
67
]
46
68
47
69
{ #category : 'as yet unclassified' }
src/MyFitnessTracker-Core/MFTTrainee.class.st
@@ -5,7 +5,8 @@
5
5
#name : 'MFTTrainee',
6
6
#superclass : 'MFTObject',
7
7
#instVars : [
8
Removed:
'routine'
8
Added:
'routine',
9
Added:
'logBook'
9
10
],
10
11
#category : 'MyFitnessTracker-Core-Base',
11
12
#package : 'MyFitnessTracker-Core',
@@ -30,7 +31,28 @@
30
31
MFTTrainee >> initialize [
31
32
32
33
super initialize.
33
Removed:
routine := MFTRoutine new
34
Added:
routine := MFTRoutine new.
35
Added:
logBook := MFTWorkoutLogBook new
36
Added:
]
37
Added:
38
Added:
{ #category : 'testing' }
39
Added:
MFTTrainee >> isRecovered [
40
Added:
41
Added:
^ logBook durationSinceLastWorkout
42
Added:
ifNotNil: [ :duration | duration > 2 days ]
43
Added:
ifNil: [ true ]
44
Added:
]
45
Added:
46
Added:
{ #category : 'accessing' }
47
Added:
MFTTrainee >> logBook [
48
Added:
49
Added:
^ logBook
50
Added:
]
51
Added:
52
Added:
{ #category : 'accessing' }
53
Added:
MFTTrainee >> logBook: aMFTWorkoutLogBook [
54
Added:
55
Added:
logBook := aMFTWorkoutLogBook
34
56
]
35
57
36
58
{ #category : 'accessing' }
src/MyFitnessTracker-Core/MFTWorkoutLog.class.st
@@ -24,12 +24,30 @@
24
24
yourself
25
25
]
26
26
27
Added:
{ #category : 'accessing' }
28
Added:
MFTWorkoutLog >> addSet: aMFTSetLog [
29
Added:
30
Added:
sets addLast: aMFTSetLog
31
Added:
]
32
Added:
27
33
{ #category : 'initialization' }
28
34
MFTWorkoutLog >> canonicalName [
29
35
30
Removed:
^ 'log for ' , prescription
36
Added:
^ prescription canonicalName , ' log'
31
37
]
32
38
39
Added:
{ #category : 'as yet unclassified' }
40
Added:
MFTWorkoutLog >> duration [
41
Added:
42
Added:
^ finish - start
43
Added:
]
44
Added:
45
Added:
{ #category : 'as yet unclassified' }
46
Added:
MFTWorkoutLog >> exercises [
47
Added:
48
Added:
^ sets collect: #exercise
49
Added:
]
50
Added:
33
51
{ #category : 'accessing' }
34
52
MFTWorkoutLog >> finish [
35
53
@@ -49,6 +67,12 @@
49
67
sets := OrderedCollection new
50
68
]
51
69
70
Added:
{ #category : 'testing' }
71
Added:
MFTWorkoutLog >> isLogged [
72
Added:
73
Added:
^ sets allSatisfy: #isLogged
74
Added:
]
75
Added:
52
76
{ #category : 'accessing' }
53
77
MFTWorkoutLog >> prescription [
54
78
@@ -91,6 +115,12 @@
91
115
MFTWorkoutLog >> start: aDateAndTime [
92
116
93
117
start := aDateAndTime
118
Added:
]
119
Added:
120
Added:
{ #category : 'accessing' }
121
Added:
MFTWorkoutLog >> startNow [
122
Added:
123
Added:
start := DateAndTime now
94
124
]
95
125
96
126
{ #category : 'accessing' }
src/MyFitnessTracker-Core/MFTWorkoutLogBook.class.st
@@ -0,0 +1,76 @@
1
Added:
"
2
Added:
I represent a log of workouts.
3
Added:
"
4
Added:
Class {
5
Added:
#name : 'MFTWorkoutLogBook',
6
Added:
#superclass : 'MFTObject',
7
Added:
#instVars : [
8
Added:
'workouts'
9
Added:
],
10
Added:
#category : 'MyFitnessTracker-Core-Logging',
11
Added:
#package : 'MyFitnessTracker-Core',
12
Added:
#tag : 'Logging'
13
Added:
}
14
Added:
15
Added:
{ #category : 'initialization' }
16
Added:
MFTWorkoutLogBook >> canonicalName [
17
Added:
18
Added:
^ workouts
19
Added:
]
20
Added:
21
Added:
{ #category : 'adding' }
22
Added:
MFTWorkoutLogBook >> durationSinceLastWorkout [
23
Added:
24
Added:
^ workouts
25
Added:
ifEmpty: [ nil ]
26
Added:
ifNotEmpty: [ DateAndTime now - workouts last finish ]
27
Added:
]
28
Added:
29
Added:
{ #category : 'initialization' }
30
Added:
MFTWorkoutLogBook >> initialize [
31
Added:
32
Added:
super initialize.
33
Added:
workouts := OrderedCollection new
34
Added:
]
35
Added:
36
Added:
{ #category : 'adding' }
37
Added:
MFTWorkoutLogBook >> lastLogForExercise: aMFTExercise [
38
Added:
"Answer the most recent workout log during which this exercise was performed."
39
Added:
40
Added:
| lastLog |
41
Added:
lastLog := (workouts select: [ :workout |
42
Added:
workout exercises includes: aMFTExercise ])
43
Added:
ifEmpty: [ ^ nil ]
44
Added:
ifNotEmpty: [ :logs | logs detectMax: #finish ].
45
Added:
^ lastLog
46
Added:
]
47
Added:
48
Added:
{ #category : 'adding' }
49
Added:
MFTWorkoutLogBook >> lastLogForPrescription: aMFTWorkoutPrescription [
50
Added:
"Answer the most recent workout log for this workout prescription."
51
Added:
52
Added:
| lastLog |
53
Added:
lastLog := (workouts select: [ :workout |
54
Added:
workout prescription = aMFTWorkoutPrescription ])
55
Added:
ifEmpty: [ ^ nil ]
56
Added:
ifNotEmpty: [ :logs | logs detectMax: #finish ].
57
Added:
^ lastLog
58
Added:
]
59
Added:
60
Added:
{ #category : 'adding' }
61
Added:
MFTWorkoutLogBook >> logWorkout: aMFTWorkoutLog [
62
Added:
63
Added:
workouts addLast: aMFTWorkoutLog
64
Added:
]
65
Added:
66
Added:
{ #category : 'as yet unclassified' }
67
Added:
MFTWorkoutLogBook >> workoutLogIsInProgress [
68
Added:
69
Added:
^ workouts last finish isNil
70
Added:
]
71
Added:
72
Added:
{ #category : 'initialization' }
73
Added:
MFTWorkoutLogBook >> workouts [
74
Added:
75
Added:
^ workouts
76
Added:
]
src/MyFitnessTracker-Core/MFTWorkoutPrescription.class.st
@@ -3,7 +3,7 @@
3
3
"
4
4
Class {
5
5
#name : 'MFTWorkoutPrescription',
6
Removed:
#superclass : 'MFTPrescription',
6
Added:
#superclass : 'MFTObject',
7
7
#instVars : [
8
8
'title',
9
9
'setGroups'
@@ -56,9 +56,9 @@
56
56
title: 'Day 3';
57
57
prescribeSuperset: {
58
58
(MFTSetPrescription exercise: MFTExercise legExtension).
59
Removed:
(MFTSetPrescription exercise: MFTExercise squat) };
59
Added:
(MFTSetPrescription exercise: MFTExercise barbellSquat) };
60
60
prescribeStraightSet:
61
Removed:
(MFTSetPrescription exercise: MFTExercise legCurl);
61
Added:
(MFTSetPrescription exercise: MFTExercise seatedLegCurl);
62
62
prescribeStraightSet:
63
63
(MFTSetPrescription exercise: MFTExercise calfRaise);
64
64
prescribeStraightSet:
@@ -82,12 +82,6 @@
82
82
83
83
super initialize.
84
84
setGroups := OrderedCollection new
85
Removed:
]
86
Removed:
87
Removed:
{ #category : 'testing' }
88
Removed:
MFTWorkoutPrescription >> isWorkout [
89
Removed:
90
Removed:
^ true
91
85
]
92
86
93
87
{ #category : 'as yet unclassified' }
src/MyFitnessTracker-Core/ManifestMyFitnessTrackerCore.class.st
@@ -0,0 +1,10 @@
1
Added:
"
2
Added:
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
3
Added:
"
4
Added:
Class {
5
Added:
#name : 'ManifestMyFitnessTrackerCore',
6
Added:
#superclass : 'PackageManifest',
7
Added:
#category : 'MyFitnessTracker-Core-Manifest',
8
Added:
#package : 'MyFitnessTracker-Core',
9
Added:
#tag : 'Manifest'
10
Added:
}
src/MyFitnessTracker-Utils/ManifestMyFitnessTrackerUtils.class.st
@@ -1,10 +0,0 @@
1
Removed:
"
2
Removed:
Please describe the package using the class comment of the included manifest class. The manifest class also includes other additional metadata for the package. These meta data are used by other tools such as the SmalllintManifestChecker and the critics Browser
3
Removed:
"
4
Removed:
Class {
5
Removed:
#name : 'ManifestMyFitnessTrackerUtils',
6
Removed:
#superclass : 'PackageManifest',
7
Removed:
#category : 'MyFitnessTracker-Utils-Manifest',
8
Removed:
#package : 'MyFitnessTracker-Utils',
9
Removed:
#tag : 'Manifest'
10
Removed:
}
src/MyFitnessTracker-Web/MFTFileLibrary.class.st
@@ -24,8 +24,7 @@
24
24
| fileRef |
25
25
fileRef := self class defaultCssPath asFileReference.
26
26
(fileRef exists and: [ fileRef isFile ]) ifFalse: [
27
Removed:
^ '/* MFT: CSS file not found: ' , fileRef fullName
28
Removed:
, ' */' asByteArray ].
27
Added:
^ '/* CSS file not found: ' , fileRef fullName , ' */' asByteArray ].
29
28
30
29
^ fileRef readStreamDo: [ :in | in contents ]
31
30
]
src/MyFitnessTracker-Web/MFTFooterComponent.class.st
@@ -9,7 +9,7 @@
9
9
{ #category : 'rendering' }
10
10
MFTFooterComponent >> renderContentOn: html [
11
11
12
Removed:
html div with: [
12
Added:
html footer: [
13
13
html paragraph: [
14
14
html text:
15
15
'Copyright 2023–' , Date today year asString , ' Marius PETER ' ] ]
src/MyFitnessTracker-Web/MFTHomePage.class.st
@@ -4,7 +4,8 @@
4
4
#instVars : [
5
5
'plan',
6
6
'statusComponent',
7
Removed:
'nextWorkoutComponent'
7
Added:
'nextWorkoutComponent',
8
Added:
'mainActionsComponent'
8
9
],
9
10
#category : 'MyFitnessTracker-Web-Components',
10
11
#package : 'MyFitnessTracker-Web',
@@ -22,25 +23,33 @@
22
23
{ #category : 'initialization' }
23
24
MFTHomePage >> initialize [
24
25
26
Added:
| nextWorkout |
25
27
super initialize.
26
28
plan := (MFTPlan forRoutine: MFTRoutine heavyDutyOneIdealRoutine)
27
29
startNow.
28
30
statusComponent := MFTStatusComponent forPlan: plan.
29
Removed:
nextWorkoutComponent := MFTWorkoutPrescriptionComponent forPrescription:
30
Removed:
plan workouts first
31
Added:
32
Added:
nextWorkout := plan nextWorkout.
33
Added:
nextWorkoutComponent := (MFTWorkoutPrescriptionComponent
34
Added:
forPrescription: plan workouts first)
35
Added:
title:
36
Added:
'Next Workout: ' , nextWorkout asString;
37
Added:
isLoggable
31
38
]
32
39
33
40
{ #category : 'rendering' }
34
41
MFTHomePage >> renderContentOn: html [
35
42
36
Removed:
html heading
37
Removed:
level: 1;
38
Removed:
with: plan routine canonicalName capitalized.
39
Removed:
html heading
40
Removed:
level: 2;
41
Removed:
with: plan canonicalName capitalized.
42
Removed:
html render: statusComponent.
43
Removed:
html render: nextWorkoutComponent
43
Added:
self renderPageOn: html with: [
44
Added:
html heading
45
Added:
level: 1;
46
Added:
with: plan routine canonicalName capitalized.
47
Added:
html heading
48
Added:
level: 2;
49
Added:
with: plan canonicalName capitalized.
50
Added:
html render: statusComponent.
51
Added:
html render: mainActionsComponent.
52
Added:
html render: nextWorkoutComponent ]
44
53
]
45
54
46
55
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTNavbarComponent.class.st
@@ -12,28 +12,11 @@
12
12
| pm |
13
13
pm := self session pageManager.
14
14
15
Removed:
html navigation
16
Removed:
style: 'position: fixed;
17
Removed:
bottom: 2em;
18
Removed:
left: 0;
19
Removed:
right: 0';
20
Removed:
with: [
21
Removed:
html unorderedList
22
Removed:
style: 'position: relative;
23
Removed:
padding: 0.5em;
24
Removed:
margin: 0 auto;
25
Removed:
max-width: 61.8vw;
26
Removed:
display: flex;
27
Removed:
flex-direction: row;
28
Removed:
justify-content: space-evenly;
29
Removed:
border-radius: 1em 1em 0 0;
30
Removed:
background-color: dimGray;
31
Removed:
list-style-type: none';
32
Removed:
with: [
33
Removed:
pm mainPages collect: [ :page |
34
Removed:
html listItem: [
35
Removed:
html anchor
36
Removed:
style: 'padding: 0.5em; color: white';
37
Removed:
callback: [ pm setActivePage: page class ];
38
Removed:
with: page title ] ] ] ]
15
Added:
html navigation: [
16
Added:
html unorderedList: [
17
Added:
pm mainPages collect: [ :page |
18
Added:
html listItem: [
19
Added:
html anchor
20
Added:
callback: [ pm setActivePage: page class ];
21
Added:
with: page title ] ] ] ]
39
22
]
src/MyFitnessTracker-Web/MFTPage.class.st
@@ -6,6 +6,14 @@
6
6
#tag : 'Components'
7
7
}
8
8
9
Added:
{ #category : 'rendering' }
10
Added:
MFTPage >> renderPageOn: html with: aBlock [
11
Added:
12
Added:
html div
13
Added:
id: 'content';
14
Added:
with: aBlock
15
Added:
]
16
Added:
9
17
{ #category : 'accessing' }
10
18
MFTPage >> title [
11
19
src/MyFitnessTracker-Web/MFTPlanPage.class.st
@@ -28,10 +28,11 @@
28
28
{ #category : 'rendering' }
29
29
MFTPlanPage >> renderContentOn: html [
30
30
31
Removed:
html heading
32
Removed:
level: 1;
33
Removed:
with: plan canonicalName capitalized.
34
Removed:
html render: routineComponent
31
Added:
self renderPageOn: html with: [
32
Added:
html heading
33
Added:
level: 1;
34
Added:
with: plan canonicalName capitalized.
35
Added:
html render: routineComponent ]
35
36
]
36
37
37
38
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTStatusComponent.class.st
@@ -39,8 +39,15 @@
39
39
40
40
html definitionList: [
41
41
html definitionTerm: 'Last workout'.
42
Removed:
html definitionData: plan.
42
Added:
html definitionData: (self session user logBook workouts
43
Added:
ifNotEmpty: [ :workoutLogs |
44
Added:
| lastLog |
45
Added:
lastLog := workoutLogs last.
46
Added:
lastLog prescription asString , ' completed '
47
Added:
, lastLog finish asDate asString , ' at '
48
Added:
, lastLog finish asTime print24 ]
49
Added:
ifEmpty: [ 'no workout logged' ]).
43
50
44
Removed:
html definitionTerm: 'Recovery'.
45
Removed:
html definitionData: plan ]
51
Added:
html definitionTerm: 'Recovery completed'.
52
Added:
html definitionData: self session user isRecovered ]
46
53
]
src/MyFitnessTracker-Web/MFTWorkoutLogComponent.class.st
@@ -2,7 +2,8 @@
2
2
#name : 'MFTWorkoutLogComponent',
3
3
#superclass : 'WAComponent',
4
4
#instVars : [
5
Removed:
'workoutLog'
5
Added:
'workoutLog',
6
Added:
'setGroupComponents'
6
7
],
7
8
#category : 'MyFitnessTracker-Web-Components',
8
9
#package : 'MyFitnessTracker-Web',
@@ -14,24 +15,42 @@
14
15
15
16
^ self new
16
17
workoutLog:
17
Removed:
(MFTWorkoutLog forPrescription: aMFTWorkoutPrescription);
18
Added:
(MFTWorkoutLog forPrescription: aMFTWorkoutPrescription) startNow;
18
19
yourself
19
20
]
20
21
21
22
{ #category : 'rendering' }
22
Removed:
MFTWorkoutLogComponent >> renderActionsOn: html [
23
Added:
MFTWorkoutLogComponent >> renderContentOn: html [
23
24
24
Removed:
html form: [
25
Removed:
html submitButton
26
Removed:
callback: [ self answer: workoutLog ];
27
Removed:
with: 'Finish' ]
25
Added:
html div
26
Added:
class: 'workout-card';
27
Added:
with: [
28
Added:
html heading
29
Added:
level: 3;
30
Added:
with: workoutLog asString.
31
Added:
self renderLogsOn: html ]
28
32
]
29
33
30
34
{ #category : 'rendering' }
31
Removed:
MFTWorkoutLogComponent >> renderContentOn: html [
35
Added:
MFTWorkoutLogComponent >> renderLogsOn: html [
32
36
33
Removed:
html render: workoutLog.
34
Removed:
self renderActionsOn: html
37
Added:
workoutLog prescription setGroups do: [ :setGroup |
38
Added:
html heading
39
Added:
level: 4;
40
Added:
with: setGroup asString.
41
Added:
html form: [
42
Added:
html orderedList: [
43
Added:
setGroup sets do: [ :setPrescription |
44
Added:
html listItem: setPrescription exercise ] ].
45
Added:
html submitButton
46
Added:
callback: [ self answer: (workoutLog finish: DateAndTime now) ];
47
Added:
with: 'Log' ] ]
48
Added:
]
49
Added:
50
Added:
{ #category : 'accessing' }
51
Added:
MFTWorkoutLogComponent >> title [
52
Added:
53
Added:
^ 'Log'
35
54
]
36
55
37
56
{ #category : 'accessing' }
src/MyFitnessTracker-Web/MFTWorkoutPrescriptionComponent.class.st
@@ -2,6 +2,8 @@
2
2
#name : 'MFTWorkoutPrescriptionComponent',
3
3
#superclass : 'WAComponent',
4
4
#instVars : [
5
Added:
'title',
6
Added:
'isLoggable',
5
7
'workoutPrescription'
6
8
],
7
9
#category : 'MyFitnessTracker-Web-Components',
@@ -13,20 +15,21 @@
13
15
MFTWorkoutPrescriptionComponent class >> forPrescription: aMFTWorkoutPrescription [
14
16
15
17
^ self new
16
Removed:
prescription: aMFTWorkoutPrescription;
18
Added:
workoutPrescription: aMFTWorkoutPrescription;
17
19
yourself
18
20
]
19
21
20
Removed:
{ #category : 'as yet unclassified' }
21
Removed:
MFTWorkoutPrescriptionComponent >> prescription [
22
Added:
{ #category : 'rendering' }
23
Added:
MFTWorkoutPrescriptionComponent >> initialize [
22
24
23
Removed:
^ workoutPrescription
25
Added:
super initialize.
26
Added:
isLoggable := false
24
27
]
25
28
26
Removed:
{ #category : 'as yet unclassified' }
27
Removed:
MFTWorkoutPrescriptionComponent >> prescription: aMFTWorkoutPrescription [
29
Added:
{ #category : 'accessing' }
30
Added:
MFTWorkoutPrescriptionComponent >> isLoggable [
28
31
29
Removed:
workoutPrescription := aMFTWorkoutPrescription
32
Added:
isLoggable := true
30
33
]
31
34
32
35
{ #category : 'as yet unclassified' }
@@ -35,50 +38,71 @@
35
38
html form: [
36
39
html submitButton
37
40
callback: [
38
Removed:
self call:
39
Removed:
(MFTWorkoutLogComponent forPrescription: workoutPrescription) ];
40
Removed:
with: 'Log' ]
41
Added:
| workoutLog |
42
Added:
workoutLog := self call:
43
Added:
(MFTWorkoutLogComponent forPrescription:
44
Added:
workoutPrescription).
45
Added:
self session user logBook logWorkout: workoutLog ];
46
Added:
with: 'Log Workout' ]
41
47
]
42
48
43
49
{ #category : 'rendering' }
44
50
MFTWorkoutPrescriptionComponent >> renderContentOn: html [
45
51
46
52
html div
47
Removed:
style: 'border: 1px solid dimGray;
48
Removed:
border-radius: 1em;
49
Removed:
padding: 1em;
50
Removed:
margin: 1em 0;
51
Removed:
max-width: 30em';
53
Added:
class: 'workout-card';
52
54
with: [
53
55
html heading
54
56
level: 3;
55
Removed:
with: workoutPrescription.
56
Removed:
self renderActionsOn: html.
57
Added:
with: title.
58
Added:
isLoggable ifTrue: [ self renderActionsOn: html ].
57
59
self renderWorkoutSetsAsTableOn: html ]
58
60
]
59
61
60
62
{ #category : 'as yet unclassified' }
61
63
MFTWorkoutPrescriptionComponent >> renderWorkoutSetsAsTableOn: html [
62
64
63
Removed:
html form: [
64
Removed:
html table: [
65
Removed:
html tableHead: [
66
Removed:
html
67
Removed:
tableHeading: 'Muscle';
68
Removed:
tableHeading: 'Set';
69
Removed:
tableHeading: 'Exercise';
70
Removed:
tableHeading: 'Rep Scheme'.
65
Added:
html table: [
66
Added:
html tableHead: [
67
Added:
html
68
Added:
tableHeading: 'Set';
69
Added:
tableHeading: 'Muscle';
70
Added:
tableHeading: 'Exercise' ].
71
Added:
html tableBody: [
72
Added:
workoutPrescription setGroups do: [ :setGroupPrescription |
73
Added:
setGroupPrescription sets doWithIndex: [ :setPrescription :j |
74
Added:
html tableRow: [
75
Added:
j = 1 ifTrue: [
76
Added:
html tableData
77
Added:
rowSpan: setGroupPrescription setCount;
78
Added:
with: setGroupPrescription ].
79
Added:
html
80
Added:
tableData:
81
Added:
(setPrescription exercise mainActivatedMuscleGroups ifNotNil: [
82
Added:
:groups | groups joinUsing: $/ ]);
83
Added:
tableData: setPrescription exercise ] ] ] ] ]
84
Added:
]
71
85
72
Removed:
workoutPrescription setGroups doWithIndex: [
73
Removed:
:setGroupPrescription
74
Removed:
:i |
75
Removed:
setGroupPrescription sets doWithIndex: [ :setPrescription :j |
76
Removed:
html tableRow: [
77
Removed:
html
78
Removed:
tableData:
79
Removed:
(setPrescription exercise mainActivatedMuscleGroups
80
Removed:
ifNotNil: [ :groups | groups joinUsing: $/ ]);
81
Removed:
tableData: setGroupPrescription;
82
Removed:
tableData: setPrescription exercise;
83
Removed:
tableData: setPrescription repScheme ] ] ] ] ] ]
86
Added:
{ #category : 'accessing' }
87
Added:
MFTWorkoutPrescriptionComponent >> title [
88
Added:
89
Added:
^ title
90
Added:
]
91
Added:
92
Added:
{ #category : 'accessing' }
93
Added:
MFTWorkoutPrescriptionComponent >> title: aString [
94
Added:
95
Added:
title := aString
96
Added:
]
97
Added:
98
Added:
{ #category : 'accessing' }
99
Added:
MFTWorkoutPrescriptionComponent >> workoutPrescription [
100
Added:
101
Added:
^ workoutPrescription
102
Added:
]
103
Added:
104
Added:
{ #category : 'accessing' }
105
Added:
MFTWorkoutPrescriptionComponent >> workoutPrescription: aMFTWorkoutPrescription [
106
Added:
107
Added:
workoutPrescription := aMFTWorkoutPrescription
84
108
]