Skip to content

Commit

Permalink
fixed read_gym() method using copy.deepcopy() on workout zone objects
Browse files Browse the repository at this point in the history
  • Loading branch information
EsatGokcen committed Dec 31, 2024
1 parent a21fa99 commit 66daaaa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from src.controller.gym_controller import GymController
from src.controller.member_controller import MemberController
from src.controller.workout_zone_controller import WorkoutZoneController

import copy

def create_workout_zone_data():
# WORKOUT ZONE 1 - Strength Training
Expand Down Expand Up @@ -189,10 +189,10 @@ def create_gym_data():
gym1.create_member(members[4])

# WORKOUT ZONE ADDITION
gym1.add_workout_zone(workout_zones[0])
gym1.add_workout_zone(workout_zones[1])
gym1.add_workout_zone(workout_zones[2])
gym1.add_workout_zone(workout_zones[4])
gym1.add_workout_zone(copy.deepcopy(workout_zones[0]))
gym1.add_workout_zone(copy.deepcopy(workout_zones[1]))
gym1.add_workout_zone(copy.deepcopy(workout_zones[2]))
gym1.add_workout_zone(copy.deepcopy(workout_zones[4]))

# CREATE A CLASS FOR GYM
bench_press_class = ClassesController()
Expand Down Expand Up @@ -221,11 +221,11 @@ def create_gym_data():
gym2.create_member(members[5])

# WORKOUT ZONE ADDITION
gym1.add_workout_zone(workout_zones[0])
gym1.add_workout_zone(workout_zones[1])
gym1.add_workout_zone(workout_zones[2])
gym1.add_workout_zone(workout_zones[3])
gym1.add_workout_zone(workout_zones[5])
gym2.add_workout_zone(copy.deepcopy(workout_zones[0]))
gym2.add_workout_zone(copy.deepcopy(workout_zones[1]))
gym2.add_workout_zone(copy.deepcopy(workout_zones[2]))
gym2.add_workout_zone(copy.deepcopy(workout_zones[3]))
gym2.add_workout_zone(copy.deepcopy(workout_zones[5]))

# CLASS CREATION
cardio_class = ClassesController()
Expand Down
3 changes: 0 additions & 3 deletions src/controller/gym_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
from src.view.gym_view import GymView
from typing import Type

from src.view.tkinter.login_window import LoginWindow


class GymController:

def __init__(self):
Expand Down
3 changes: 3 additions & 0 deletions src/model/equipment_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ def __init__(self, name: str, type: str):
def __str__(self):
return f"\n{self.__name} for {self.__type}"

def __repr__(self):
return f"\n{self.__name} for {self.__type}"

def get_equipment_name(self) -> str:
return self.__name

Expand Down
4 changes: 2 additions & 2 deletions src/model/gym_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def get_gym_workout_zones(self) -> list[WorkoutZoneModel]:
def get_equipments_for_workout_zones(self) -> list[EquipmentModel]:
equipment_list = []
for workout_zone in self.__workout_zones:
equipment_list.append(workout_zone.get_list_of_equipments())
return equipment_list # BROKEN
equipment_list.append(workout_zone.get_list_of_equipments())
return equipment_list

def get_list_of_staff(self) -> list[StaffModel]:
return self.__list_of_staff
Expand Down

0 comments on commit 66daaaa

Please sign in to comment.