Feat: Allow optional golds and personal_best in split files#61
Feat: Allow optional golds and personal_best in split files#61alexozer merged 10 commits intoalexozer:mainfrom
Conversation
This reverts commit 1d2b2b2, due to a typo.
|
Have yet to update the JSON example file + readme; converted to draft for now. |
|
Thanks again! Would you mind updating the README to indicate that the personal best and gold JSON fields are now optional, as well? EDIT: nvm, just saw your previous comment |
Welcome, this is also me learning to contribute! The README is updated now; feel free to reword it as you see fit. |
|
@Vxwilson What would you think of wrapping the |
|
@alexozer I agree with your judgement there, wrapping it with While we are at it, what's your opinion on extending this approach to other fields? I could see an argument for making |
|
I think defaulting attempts/completed to 0 definitely makes sense for new
split files! Requiring a category name upfront probably isn't too
unreasonable though.
Alex Ozer
…On Mon, Oct 13, 2025, 4:14 AM Pong Vei Xhen ***@***.***> wrote:
*Vxwilson* left a comment (alexozer/flitter#61)
<#61 (comment)>
@alexozer <https://github.com/alexozer> I agree with your judgement
there, wrapping it with Optional is cleaner and makes the code more
robust against future changes. I've pushed up the changes, lmk if that
looks right; appreciate your feedback!
While we are at it, what's your opinion on extending this approach to
other fields? I could see an argument for making attempts/completed
default to 0, and category default to an empty string. But those are
relatively effortless for users to configure, so it shouldn't be a big
issue.
—
Reply to this email directly, view it on GitHub
<#61 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAP2NUWCHU5ILDTG45M5KDL3XNNMTAVCNFSM6AAAAACI7CDHXSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOJWGM2TGOJYHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@alexozer Done. No validation needed for this part (IMO) as the counter should self-correct as the user perform new runs. This feature branch should be ready to merge now, thanks for being patient :) |
More minor formatting corrections
Some changes in
split_fileandtimerthat should simplify new split file creation.Closes #60 and #56.
Problem
attemptnot correctly registering when new PB is created (see PBattemptin JSON not updated when new PB is achieved. #60 ). Fixed intimer.rswith a one-liner.goldsandpersonal_bestfields, even though this data doesn't exist before the first run (see Don't require filled out fields in initial splits file #56). Personally, I also find having to enter all values confusing ("does entering all 0s' work?") See below for details.Solution
Make
goldsandpersonal_bestfields in the JSON optional, allowing users to create a minimal file with just atitle,category, andsplit_names. The application will now handle missing fields on first load without crashing by initializing with blank values.Details
split_file.rs:#[serde(default)]to makegoldsandpersonal_bestoptional during deserialization.Nonevalues if missing.timer.rs:save_personal_besthandles case where no previous PB exists.Simple Test
Example
splitJSON with minimal config:Steps:
-.Backspaceto reset and save. The JSON should update to store the gold splits.Backspace, the JSON should update accordingly.