Skip to content
This repository was archived by the owner on Jun 17, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions src/main/java/MakeItFit/MakeItFit.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
package MakeItFit;

import java.io.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.List;
import java.util.UUID;

import MakeItFit.activities.Activity;
import MakeItFit.exceptions.*;
import MakeItFit.queries.*;
import MakeItFit.trainingPlan.*;
import MakeItFit.users.*;
import MakeItFit.exceptions.EntityDoesNotExistException;
import MakeItFit.exceptions.ExistingEntityConflictException;
import MakeItFit.exceptions.InvalidTypeException;
import MakeItFit.queries.QueriesManager;
import MakeItFit.trainingPlan.TrainingPlan;
import MakeItFit.trainingPlan.TrainingPlanManager;
import MakeItFit.users.Gender;
import MakeItFit.users.User;
import MakeItFit.users.UserManager;
import MakeItFit.utils.MakeItFitDate;

/**
Expand Down Expand Up @@ -132,7 +143,7 @@ public User getUser(Object identifier) throws InvalidTypeException {
public void updateUserName(String name, String email) {
User user = getUser(email);
user.setName(name);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please write a quick comment that you changed this, for further record

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote this kind of change in my notes. Do you want me to write it in the code?

}

/**
Expand All @@ -144,7 +155,7 @@ public void updateUserName(String name, String email) {
public void updateUserAge(int age, String email) {
User user = getUser(email);
user.setAge(age);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -156,7 +167,7 @@ public void updateUserAge(int age, String email) {
public void updateUserGender(Gender gender, String email) {
User user = getUser(email);
user.setGender(gender);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -168,7 +179,7 @@ public void updateUserGender(Gender gender, String email) {
public void updateUserWeight(float weight, String email) {
User user = getUser(email);
user.setWeight(weight);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -180,7 +191,7 @@ public void updateUserWeight(float weight, String email) {
public void updateUserHeight(int height, String email) {
User user = getUser(email);
user.setHeight(height);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -192,7 +203,7 @@ public void updateUserHeight(int height, String email) {
public void updateUserBpm(int bpm, String email) {
User user = getUser(email);
user.setBpm(bpm);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -204,7 +215,7 @@ public void updateUserBpm(int bpm, String email) {
public void updateUserLevel(int level, String email) {
User user = getUser(email);
user.setLevel(level);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -216,7 +227,7 @@ public void updateUserLevel(int level, String email) {
public void updateUserAddress(String address, String email) {
User user = getUser(email);
user.setAddress(address);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
Expand All @@ -228,19 +239,22 @@ public void updateUserAddress(String address, String email) {
public void updateUserPhone(String phone, String email) {
User user = getUser(email);
user.setPhone(phone);
this.userManager.updateUser(user);
// this.userManager.updateUser(user);
}

/**
* This function was previously incorrect because it relied on updating the user
* with the modified email, which could cause issues with user identification.
* Updates the user's email address.
*
* @param email The new email address for the user.
* @param email The user's email.
*/
public void updateUserEmail(String email, String newEmail) {
User user = getUser(email);
this.userManager.removeUserByEmail(email);
user.setEmail(newEmail);
this.userManager.updateUser(user);
this.userManager.insertUser(user);
}

/**
Expand Down
Loading