View raw

1 " 2 I represent a set logged against a prescription. 3 " 4 Class { 5 #name : 'MFTSetLog', 6 #superclass : 'MFTObject', 7 #instVars : [ 8 'prescription', 9 'reps', 10 'load', 11 'failureAchieved' 12 ], 13 #category : 'MyFitnessTracker-Core-Logging', 14 #package : 'MyFitnessTracker-Core', 15 #tag : 'Logging' 16 } 17 18 { #category : 'accessing' } 19 MFTSetLog class >> forPrescription: aMFTSetPrescription [ 20 21 ^ self new 22 prescription: aMFTSetPrescription; 23 yourself 24 ] 25 26 { #category : 'as yet unclassified' } 27 MFTSetLog class >> reps: anInteger load: aNumber [ 28 29 ^ self new 30 reps: anInteger; 31 load: aNumber; 32 yourself 33 ] 34 35 { #category : 'initialization' } 36 MFTSetLog >> canonicalName [ 37 38 ^ self isLogged 39 ifTrue: [ 40 reps asString , '×' , load asString , ' ' 41 , prescription exercise canonicalName ] 42 ifFalse: [ 'unlogged set' ] 43 ] 44 45 { #category : 'accessing' } 46 MFTSetLog >> exercise [ 47 48 ^ prescription exercise 49 ] 50 51 { #category : 'accessing' } 52 MFTSetLog >> failureAchieved [ 53 54 ^ failureAchieved 55 ] 56 57 { #category : 'accessing' } 58 MFTSetLog >> failureAchieved: aBoolean [ 59 60 failureAchieved := aBoolean 61 ] 62 63 { #category : 'initialization' } 64 MFTSetLog >> initialize [ 65 66 super initialize. 67 failureAchieved := false 68 ] 69 70 { #category : 'as yet unclassified' } 71 MFTSetLog >> intensityFactor [ 72 73 failureAchieved ifTrue: [ ^ 100 ]. 74 "TODO: determine intensity factor as a function of PR and maybe workout duration" 75 ^ 0 76 ] 77 78 { #category : 'initialization' } 79 MFTSetLog >> isLogged [ 80 81 ^ reps isNotNil and: [ load isNotNil ] 82 ] 83 84 { #category : 'as yet unclassified' } 85 MFTSetLog >> load [ 86 87 ^ load 88 ] 89 90 { #category : 'as yet unclassified' } 91 MFTSetLog >> load: aNumber [ 92 93 load := aNumber 94 ] 95 96 { #category : 'as yet unclassified' } 97 MFTSetLog >> prescription [ 98 99 ^ prescription 100 ] 101 102 { #category : 'as yet unclassified' } 103 MFTSetLog >> prescription: aMFTSetPrescription [ 104 105 prescription := aMFTSetPrescription 106 ] 107 108 { #category : 'as yet unclassified' } 109 MFTSetLog >> progressionDecision [ 110 111 ^ prescription repScheme progressionFor: reps 112 ] 113 114 { #category : 'as yet unclassified' } 115 MFTSetLog >> reps [ 116 117 ^ reps 118 ] 119 120 { #category : 'as yet unclassified' } 121 MFTSetLog >> reps: anInteger [ 122 123 reps := anInteger 124 ] 125 126 { #category : 'as yet unclassified' } 127 MFTSetLog >> volume [ 128 129 ^ (reps isNil or: [ load isNil ]) 130 ifTrue: [ 0 ] 131 ifFalse: [ reps * load ] 132 ] 133