-
Notifications
You must be signed in to change notification settings - Fork 72
Project finished #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Project finished #60
Conversation
chrisjamiecarter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jollejonas 👋,
Excellent work on your ExerciseTracker project submission 🎉!
I have performed a peer review and have added some comments. Review/ignore as you wish.
🟠 Needs better validation handling, you can input an endTime less than the startTime, but when you do, it fails to save, and then the app becomes unusable. i.e., subsequent valid entry will also fail to be added.
I suggest revisiting to try understand and fix any issues 🔧 , but as these do not relate to the requirements they will not block my approval.
Feel free to reach out if you have any questions or if you'd like to collaborate further on any of these points 🆘 .
I will go ahead and mark as approved, keep up the excellent work on the next projects! 😊
Best regards,
@chrisjamiecarter 👍
| using ExerciseTracker.jollejonas.Models; | ||
|
|
||
| namespace ExerciseTracker.jollejonas.Controllers; | ||
| public class ExerciseController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Clean Controller
⭐ Nice, clean and lightweight!
|
|
||
| protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | ||
| { | ||
| optionsBuilder.UseSqlServer("Server = (localdb)\\mssqllocaldb; Database = ExerciseTrackerContext; Trusted_Connection = True; MultipleActiveResultSets = true"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟠 AppSettings
💡 ConnectionStrings should be stored in appsettings or app.config and also retrieved from there. It seems like you have an appsettings, and a connectionstring value, but are just not using it.
| } | ||
| }, | ||
| "ConnectionStrings": { | ||
| "PhonebookContext": "Server=(localdb)\\mssqllocaldb;Database=ExerciseTrackerContext;Trusted_Connection=True;MultipleActiveResultSets=true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ PhonebookContext
| using ExerciseTracker.jollejonas.Enums; | ||
| using ExerciseTracker.jollejonas.Repositories; | ||
|
|
||
| class Program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ No README of how to use your app
|
|
||
| public enum MenuOptions | ||
| { | ||
| AddExercise = 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Why start at 1 and not 0
|
|
||
| namespace ExerciseTracker.jollejonas.Repositories; | ||
|
|
||
| public class ExerciseRepository : IExerciseRepository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Clean Repository
⭐ Nice, clean and lightweight repository
| { | ||
| if (id == 0) | ||
| { | ||
| throw new ArgumentNullException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ id == 0 does not equal id == null... Should this not be ArgumentOutOfRangeException or something more relevant.
| } | ||
| if (!_context.Exercises.Any(e => e.Id == id)) | ||
| { | ||
| throw new KeyNotFoundException(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Improve Logic
💡 You could have made the return type of this method a nullable Exercise, i.e., public Exercise? GetExerciseById(int id) { ... }
Then here you could have done return null; or better yet, exclude this all together, as your line below return _context.Exercises.FirstOrDefault(e => e.Id == id); will return null if the ID does not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Repository Interface
⭐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 Service Pattern
⭐

Project finished. Looking forward to your review! 😄