❔ I tried to substract two TimeSpan objects but nothing happened
I have been trying to add to add a goal feature in my application (a coding tracker), but I haven't been able to update the progress of the goal of the user
What I'm trying to do here is: 1. Store in a variable each coding session which has been started after the first goal was added by the user (example, user added his goal 1 hour ago, so then every coding session after the user added his goal, will be stored)
2. Add to GoalProgress all the durations of those sessions
3. Return GoalProgress to use it later
Then here comes the problem:
I tried to calculate the progress by substracting GoalProgress to GoalValue, but the value of that operation will always be equal to GoalValue (the original goal the user inserted)
This is the void in which the values of my Goal model are inserted into my SQLite database:
8 Replies
Pastebin
public static void SetGoal() { var timeUnit = Use...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is my repo in case you'd rather check my code there:
https://github.com/JsPeanut/CodeReviews.Console.CodingTracker
GitHub
GitHub - JsPeanut/CodeReviews.Console.CodingTracker
Contribute to JsPeanut/CodeReviews.Console.CodingTracker development by creating an account on GitHub.
Did you debug your code? Does DisplayGoal actually return a non zero value?
Set a breakpoint right here:
It doesn't even appear lol
If you set a breakpoint on the WriteLine it's not going to show...you need to step into the method and see what it returns
We won't debug for you but after skimming the code, there are some possible places things could've went wrong even before your DisplayGoal method
In your GetAllRecords method, do your rows actually have a valid duration value?
In your ParseGoalIntoTimeSpan, do your goals have a valid time too?
Do you actually have any coding sessions beginning after the goal is added?
Do your coding sessions actually have a duration greater than 0?
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.