pjf / WebService-HabitRPG

Access the HabitRPG API from Perl
8 stars 5 forks source link

Sort completeable tasks by active/inactive/completed. #10

Open wizonesolutions opened 11 years ago

wizonesolutions commented 11 years ago

Currently, hrpg daily shows all dailies. However, HabitRPG allows configuring on which days dailies are active or not. If they are not active, I think they should be displayed differently.

Current/Desired

This is what currently happens:

$ hrpg daily

[X] 10 minutes max on one overdue task
[ ] 10 minutes on reading/learning something new
[ ] 10 minutes on Fill PDF Service
[ ] Put done tasks into iDoneThis

In this example, "10 minutes on Fill PDF Service" is something that only applies Monday through Friday.

This is a suggestion for what could happen:

$ hrpg daily

Active dailies:
-------------------- (longer than this)
[X] 10 minutes max on one overdue task
[ ] 10 minutes on reading/learning something new
[ ] Put done tasks into iDoneThis

Inactive dailies:
----------------------
[ ] 10 minutes on Fill PDF Service

I still prefer for all dailies to be shown — sometimes I do and check off inactive dailies anyway, like if I didn't get to them the day before.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/1388385-sort-completeable-tasks-by-active-inactive-completed?utm_campaign=plugin&utm_content=tracker%2F433776&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F433776&utm_medium=issues&utm_source=github).
pjf commented 11 years ago

Possible options:

On a side note, there should probably be a hrpg todo -a (or equivalent) that shows completed todos.

wizonesolutions commented 11 years ago

1 for me. I considered all the other ones but thought grouped was the

ideal default. Maybe filtering with switches. I would accept the hyphen for not due today though; that was my initial idea, but it felt like I'd think I couldn't check it off anyway or something.

If we go with hyphen, I'd want the tasks in their normal order then, not grouped. On Mar 23, 2013 3:10 PM, "Paul Fenwick" notifications@github.com wrote:

Possible options:

  • Active and inactive lists of dailies. (Possibly inactive first, so if we scroll you miss the least important things.)
  • List as is, but [X] for done, [ ] for not done, and [-] for not due today.
  • Just completely filter out not-due daily tasks.
  • Any or all of the above, selected by command-line options. Eg: hrpg daily -a shows everything.

On a side note, there should probably be a hrpg todo -a (or equivalent) that shows completed todos.

— Reply to this email directly or view it on GitHubhttps://github.com/pjf/WebService-HabitRPG/issues/10#issuecomment-15337628 .

wizonesolutions commented 11 years ago

How do you think this would be achieved? I think I'd take a shot at this first to warm up.

pjf commented 11 years ago

Oh, over around https://github.com/pjf/WebService-HabitRPG/blob/master/bin/hrpg#L260 is where we do the formatting and output.

If $task->{completed} is true, then it's done. Otherwise it isn't. :)

format_task has an example of doing some simply checking and formatting.

You could probably sort tasks by completeness if you wanted (as a first pass):

my @sorted_tasks = sort { $a->{completed} <=> $b->{completed} } @$tasks;

foreach my $task (@sorted_tasks) {
   say format_task($task);
}
wizonesolutions commented 11 years ago

Oh OK, fantastic. I haven't looked in depth, but it looks like I can mostly read the code already (the $-prefixed variables make me happy as a PHP developer). I can basically see what I need to do for a first pass, so if I have time this evening I'll give it a shot! It looks pretty trivial.

Is there a way btw to run hrpg from the build directory? So that I don't have to constantly reinstall it while testing.

On Fri, Apr 5, 2013 at 12:02 PM, Paul Fenwick notifications@github.comwrote:

Oh, over around https://github.com/pjf/WebService-HabitRPG/blob/master/bin/hrpg#L260 is where we do the formatting and output.

If $task->{completed} is true, then it's done. Otherwise it isn't. :)

format_taskhttps://github.com/pjf/WebService-HabitRPG/blob/master/bin/hrpg#L495has an example of doing some simply checking and formatting.

You could probably sort tasks by completeness if you wanted (as a first pass):

my @sorted_tasks = sort { $a->{completed} <=> $b->{completed} } @$tasks;

foreach my $task (@sorted_tasks) { say format_task($task); }

— Reply to this email directly or view it on GitHubhttps://github.com/pjf/WebService-HabitRPG/issues/10#issuecomment-15947750 .

pjf commented 11 years ago

Absolutely!

dzil build
cd WebService-HabitRPG-0.13/    # Or whatever the dir is called
perl -Ilib bin/hrpg status   # -I says 'use this directory for includes

Although unless you're actually changing the underlying HabitRPG.pm file, you can just ./hrpg whatever in the development directory, and it should work fine, which is what I do. The "build" process of the executable involves moving some of the documentation around and maybe filling in a version number.

wizonesolutions commented 11 years ago

Seems like I do need to do perl -Ilib bin/hrpg to run it from dev. Otherwise it errors out pretty fast.

wizonesolutions commented 11 years ago

Also, is there a way to always dzil build to the same directory? e.g. WebService-HabitRPG-Dev. I am thinking of telling Vim to build it each time I save because it doesn't take very long.

pjf commented 11 years ago

dzil build --in Your-Dir-Goes-Here

I've never tried it, but it's mentioned in dzil help build