Just finished up the error handling with the app and changed the file saving feature so that it now includes the date of the generation, which doesn't overwrite previous versions in case someone wanted to keep track of the workouts they were doing and when they were doing them.

This commit is contained in:
William Brawner 2015-06-28 16:52:20 -05:00
parent 3431fdf589
commit 3d07f272c3

View file

@ -1,6 +1,9 @@
from random import sample
from exercises import *
log = open("/home/billy/Desktop/Workout.txt", "w")
from time import sleep
from datetime import date
today = str(date.today())
log = open("/home/billy/Desktop/Workout " + today + ".txt", "w")
#Create the generator class which will actually create the routines according to the desired number of days per week.
class Generator(object):
@ -29,7 +32,7 @@ class Generator(object):
self.template = '| {:^50} | {:^7} | {:^6} | {:^12} | {:^12} |'
break
else:
print ("Sorry, please try again.")
print ("Please enter strength, endurance, or hypertrophy.")
goal = input("Is your goal to gain strength, endurance, or hypertrophy?\n>>> ")
goal = goal.lower()
return self.sets, self.target_reps, self.actual_reps, self.template
@ -49,6 +52,14 @@ class Generator(object):
break
return self.experience
def check_experience(self, experience):
while self.experience > 3 or self.experience < 1:
print("Please choose between choice 1, 2, or 3.")
self.experience = Generator.get_experience(self)
else:
pass
return self.experience
def get_frequency(self):
#Ask the user how many days per week they want to work out and store that number in a variable called
#"days".
@ -362,14 +373,17 @@ class Generator(object):
#given is less than 7.
Generator.footer()
class Engine(object):
def start(Generator):
Generator.get_goal()
Generator.get_preferences()
experience = Generator.get_experience()
experience = Generator.check_experience(experience)
days = Generator.get_frequency()
days = Generator.check_frequency(days)
Generator.create_workout(experience, days)
log.close()
gen1 = Generator()
Engine.start(gen1)