Skip to content

Implement progress bar with custom goal#87

Merged
Quorafind merged 11 commits into
taskgenius:masterfrom
fastrick:custom-progress-feature
Apr 20, 2025
Merged

Implement progress bar with custom goal#87
Quorafind merged 11 commits into
taskgenius:masterfrom
fastrick:custom-progress-feature

Conversation

@fastrick
Copy link
Copy Markdown
Contributor

@fastrick fastrick commented Apr 13, 2025

Feature Description:

Bug 1 Description:

  • When the user uses a custom goal and a child task does not contain the pattern, a single progress unit is incorrectly added to the parent task (goal).

Situation 1 (Bug occurs):

- [ ] Read book [g::100]  // Rendered Progress: 1/100
   - [x] Task without a goal pattern

Situation 2 (Works as expected):

- [ ] Read book [g::100]  // Rendered Progress: 25/100
   - [x] Task without a goal pattern
   - [x] Child goal g::10
   - [x] Another child goal g::15

Currently, as long as at least one child task includes the goal pattern, progress is calculated correctly.


PR Roadmap:

  • Fix the BUG 1.
  • Add an option in the plugin settings to toggle custom goal feature.
  • Implement support in Reading View.
  • Remove the debug logs
  • Refactor and better organize the code.

@fastrick fastrick changed the title Implement just in readMode View. Implement custom progress bar Apr 13, 2025
@fastrick fastrick changed the title Implement custom progress bar Implement progress bar with custom goal Apr 13, 2025
@fastrick fastrick force-pushed the custom-progress-feature branch from d13fad0 to 3a316a9 Compare April 19, 2025 20:56
@fastrick fastrick marked this pull request as ready for review April 19, 2025 21:01
@fastrick
Copy link
Copy Markdown
Contributor Author

@Quorafind If my code needs adjustments to better fit your coding style, I can make the changes.

Copy link
Copy Markdown
Collaborator

@Quorafind Quorafind left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread src/utils/goal/editMode.ts Outdated
if (!taskText) return null;

// Match only the patterns g::number or goal::number
const goalMatch = taskText.match(/\b(g|goal)::(\d+)\b/i);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it better to use \b(g|goal)::\s*(\d+)\b? Sometimes people want to add a space between :: and digital.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good tip. I'll adjust it to just one space or no space. What do you think? \b(g|goal)::(\s|\d+)\b

Copy link
Copy Markdown
Collaborator

@Quorafind Quorafind Apr 20, 2025

Choose a reason for hiding this comment

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

Using \b(g|goal)::\s*?(\d+)\b would be better in your case. https://regex101.com/r/GViCZt/2

Otherwise, the match would not work: https://regex101.com/r/GViCZt/1

Copy link
Copy Markdown
Contributor Author

@fastrick fastrick Apr 20, 2025

Choose a reason for hiding this comment

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

The first version allows multiple spaces. What do you think about limiting it to a single space instead?
\b(g|goal)::\s{0,1}(\d+)\b
https://regex101.com/r/aYBif2/2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Quorafind Quorafind merged commit ef751fa into taskgenius:master Apr 20, 2025
Quorafind added a commit that referenced this pull request Aug 27, 2025
Implement progress bar with custom goal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants