Repository navigation
Changes made - #294
Changes made#294jcisco22 wants to merge 14 commits into
Conversation
Draft
Updated README.md for clarity and corrections in text formatting, including changes to section headings, descriptions of functionalities, and validation methods.
🚀 Project Submitted!Thanks for submitting your project! I will review it soon. 📋 Please check the dashboard to make sure the project is marked as Pending. |
|
Hey @jcisco22, I was reviewing your project and I noticed that there's no way to exit the delete and update menus, and if you enter those menus while the database is empty the user can get soft locked in that menu. I noticed that in the update menu you included instructions to type 0 to return to the main menu, but that feature doesn't seem to be working. If you could please fix this I would love to continue reviewing your project! 😄 |
|
Will do |
…eteInput and UpdateInput methods.
…n the user enters 0. Insert now uses ValidateEndTime instead of duplicating the check. Removed recursive menu call from GeTimeInput. Restored dd-MM-yyyy HH:mm format.
|
Return to main menu feature now fixed. |
0lcm
left a comment
There was a problem hiding this comment.
Hey @jcisco22, I left a few comments on your code, mostly regarding some unused variables and statements, and just a couple things for keeping your code clean. If you could look over these comments when you have time and clean the code up a little I'd appreciate it! 🙃
| using Microsoft.Data.Sqlite; | ||
| using Dapper; | ||
| using Spectre.Console; |
There was a problem hiding this comment.
These using statements are never used and can be safely removed from this file
|
|
||
| class Program1 | ||
| { | ||
| static string connectionString = @"Data Source=habit-Tracker.db"; |
There was a problem hiding this comment.
This variable is never used and can be safely removed
| { | ||
| static string connectionString = @"Data Source=habit-Tracker.db"; | ||
|
|
||
| static void Main(string[] args) |
There was a problem hiding this comment.
No arguments are used in this method so the optional string[] args parameter isn't necessary and can be removed
|
|
||
| class CodingController | ||
| { | ||
| // CodingController.cs — database operations |
There was a problem hiding this comment.
This comment is unnecessary and mostly adds clutter to the code. A good rule of thumb for something like this is that the class should be named something to where it's easy to understand the purpose of the class, that way you don't have to add a comment explaining what the class should do
| { | ||
| // CodingController.cs — database operations | ||
|
|
||
| static string connectionString = new ConfigurationBuilder() |
There was a problem hiding this comment.
For a private static string the general naming convention would be to have a '_' in front of the name like _connectionString. It's not a big deal but it helps make your code cleaner and easier to refactor, plus it's usually just a good idea to follow naming conventions
| } | ||
| } | ||
|
|
||
| public static void Update(int ID, DateTime startTime, DateTime endTime, string duration) |
There was a problem hiding this comment.
The parameter int ID doesn't follow camelCase conventions, it would make more sense to name it something like id
| @@ -0,0 +1,15 @@ | |||
| // CodingSession.cs — the model | |||
There was a problem hiding this comment.
This comment isn't necessary and can be removed to keep clutter to a minimum
| @@ -0,0 +1,115 @@ | |||
| using System.Runtime.ConstrainedExecution; | |||
There was a problem hiding this comment.
This using statement isn't necessary and can be safely removed
| DateTime startTime; | ||
| DateTime endTime; |
There was a problem hiding this comment.
Both of these variables are never used after being declared, and can be removed from the code
|
|
||
| return endTime; | ||
| } | ||
| public static int ValidateId(string Input) |
There was a problem hiding this comment.
This parameter doesn't match camelCase conventions, a better name would be something like input
|
Ready for review. |
0lcm
left a comment
There was a problem hiding this comment.
Hey @jcisco22, great job on completing your project!
There were a couple things I noticed that you could probably improve on next time, especially the fact that your CodingController and Validation classes are writing to the console. I saw that you mentioned this in your README, and I'd definitely recommend trying to make your separation of concerns a little bit cleaner next time. I also noticed that the UserInput class handles both getting input from the user and writing that input to the console. I think this is a great starting point, but later on you could probably split a class like this into two separate services or helper classes, that way you could have one class that gets input, and one that writes input to the console.
I also noticed when deleting/updating a record there's no confirmation prompt to prevent accidental deletions/changes. This isn't as big of an issue right now, but I'd definitely consider adding some sort of confirmation feature in your next CRUD project.
I love that you used Spectre.Console to display data to the console with a table. I think you could definitely expand on this and use Spectre.Console for all the writing, not just the data table, but the table is very clean here and definitely a good addition.
I noticed you didn't complete any of the challenges for this project, they are of course completely optional, but I also cannot recommend them enough for your future projects. They're super educational and will almost always teach you something new!
Overall great job on your project, and if you have any questions you can leave a comment here, or you can always find me in the academy's discord server 😄


Duration recalculated on update, end time validated after start, README added.