From d5b4d8be42d143eabd15be70fe426ffcf89c7e63 Mon Sep 17 00:00:00 2001 From: Goeran Heinemann Date: Tue, 31 Mar 2020 13:10:01 +0200 Subject: [PATCH] =?UTF-8?q?anzahl=20der=20sets=20einer=20=C3=BCbung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/api/Models/Exercise.php | 8 +++++--- html/api/workout.php | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/html/api/Models/Exercise.php b/html/api/Models/Exercise.php index f1c1443..a7b6cd4 100644 --- a/html/api/Models/Exercise.php +++ b/html/api/Models/Exercise.php @@ -3,24 +3,26 @@ class Exercise { - public $id, $name, $description, $amount, $type, $unit, $current; + public $id, $name, $description, $amount, $sets, $type, $unit, $current; /** - * Workout constructor. + * Exercise constructor. * @param $id * @param $name * @param $description * @param $amount + * @param $sets * @param $type * @param $unit * @param $current */ - public function __construct($id, $name, $description, $amount, $type, $unit, $current = 0) + public function __construct($id, $name, $description, $amount, $sets, $type, $unit, $current = 0) { $this->id = $id; $this->name = $name; $this->description = $description; $this->amount = $amount; + $this->sets = $sets; $this->type = $type; $this->unit = $unit; $this->current = $current; diff --git a/html/api/workout.php b/html/api/workout.php index a4bf164..373ff68 100644 --- a/html/api/workout.php +++ b/html/api/workout.php @@ -13,7 +13,7 @@ if (isset($_GET['token'])){ $userID = $userData[0]['user']; if(isset($_GET['workout'])){ - $sql = "SELECT exercises_in_workout.id, name, description, amount, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc "; + $sql = "SELECT exercises_in_workout.id, name, description, amount, sets, type, unit FROM exercises_in_workout inner join workout_types on workout_types.id=exercises_in_workout.workout_type inner JOIN workout_type_measurements on workout_type_measurements.id=workout_types.measurement where exercises_in_workout.workout_routine=? order by exercises_in_workout.id asc "; $stmt = $pdo->prepare($sql); $stmt->bindParam(1, $_GET['workout']); if ($stmt->execute()){ @@ -21,7 +21,7 @@ if (isset($_GET['token'])){ $returnExercises = array(); foreach($exercises as $exercise){ - $returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['type'], $exercise['unit']); + $returnExercises[] = new Exercise($exercise['id'], $exercise['name'], $exercise['description'], $exercise['amount'], $exercise['sets'], $exercise['type'], $exercise['unit']); } header('Content-Type: application/json'); echo json_encode($returnExercises);