def get_lifts(self, week): #return the active lifts for this user lifts = self.user.active_lifts.all() scheme = WEEK_SCHEME[week] days = [] for lift in lifts: reduced_max = .9 * float(lift.get_onerm().weight) days.append({ 'name': lift.lift.name, 'scheme': [(scheme[0][0], round_to_plate_size(scheme[0][1]*float(reduced_max), 2.5)), (scheme[1][0], round_to_plate_size(scheme[1][1]*float(reduced_max), 2.5)), (scheme[2][0], round_to_plate_size(scheme[2][1]*float(reduced_max), 2.5))] }) return days
def get_lifts(self, week): #return the active lifts for this user lifts = self.user.active_lifts.all() cycle = (week-1)/4 #calculate cycles week = week % 4 if week == 0: week = 4 #is there a better way to do this scheme = WEEK_SCHEME[week] days = [] for lift in lifts: working_weight = self.get_working_weight(lift, cycle) lift.working_weight = working_weight days.append({ 'name': lift.lift.name, 'scheme': [(scheme[0][0], round_to_plate_size(scheme[0][1]*float(working_weight), 2.5)), (scheme[1][0], round_to_plate_size(scheme[1][1]*float(working_weight), 2.5)), (scheme[2][0], round_to_plate_size(scheme[2][1]*float(working_weight), 2.5))] }) return (days, lifts)