Workout Export

The process of upgrading the underlying server for this site has quite a few manual tasks, one being exporting any PierWorkout. When running PRKernelCreatorForPier, any PRWorkoutLog has the workouts exported as an array of PRExerciseEntries, like:

structure workouts: #(5 sets on 1 June 2015 6 sets on 3 June 2015

Initially I had planned to build a parser to use a state machine and read in each entry building up a workout. Then I saw it would be easier to modify how it is printed in:


These now display a workout with the same format used for testing in PRWorkoutTest. Modifying PRWorkoutLog>>workouts: as:

	workouts := (aCollectionOfPRWorkouts asOrderedCollection
		collectAll: [ :e |
			e isString
				ifTrue: [ self class workoutsBasedOnString: e ]
				ifFalse: [ OrderedCollection with: e ] ])
		sorted: [ :a :b | a date < b date ]
Posted by John Borden at 11 June 2021, 12:26 pm link