Subcategories

Bug #1185041 reported by Standa
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTimeLog
New
Wishlist
Unassigned

Bug Description

It is not really a bug, but a patch.

I am thinking about having a subcategories - I want change ma project to phases - so PROJ-PHASE1:, PROJ_PHASE2,...
it is simmilar to tags, but different. It is not limited to 2 levels, but any number of phases can be used in project identifier:
PROJ-PHA1-PHA2-PHA3:

Today I hade some time, so I tryied to add this to gtimelog - and to me it seems to work.

To pass settings to TimeWindow.categorized_work_entries() I replaced/added some variables in TimeWindow, TimeLog and Reports constructors with 'settings' parameter.

Subcategories are configurable with following default values:
subcategories_enabled = False
subcategories_separator = '-'

If 'subcategories_enabled' is set to True:
in reports I get:
- total for project (including all phases)
- total for all phases
- total time for the day/week/month is counted correctly

What do you think about it?
Standa

Tags: feature
Revision history for this message
Standa (standa31415) wrote :
Changed in gtimelog:
importance: Undecided → Wishlist
Revision history for this message
Marius Gedminas (mgedmin) wrote :

Sorry for responding to this so late!

Some sort of per-project subdivision sounds like a useful feature. However I don't want to rush and accept the first patch, since multiple people have expressed wishes for related things (tags, subcategories), and I wouldn't want to end up with a mismash of features that don't work together well. (That's why I ignored this bug report for so long -- but I should've said so at the beginning, and not procrastinated writing a response.)

I'd like to see concrete examples of these things you call phases. Would that be things like planning, design, implementation, testing? I'd also like to see a concrete small example of daily/weekly/monthly reports that include these.

I'm not a fan of configuration options that change the interpretation of data files. (E.g. virtual_midnight was a mistake: change it and you can get incorrect reports for past dates.)

I'm not very comfortable about passing the entire settings object to the TimeLog/Reports classes, but I cannot articulate why that feels wrong.

Revision history for this message
Standa (standa31415) wrote :

Attaching updated diff file (for v0.9.1) and samples.
gtimelog-0.9.1__subcats_withdate__20140102.diff
gtimelog-0.9.1__subcats_withdate__usage__20140102.txt

"""Some sort of per-project subdivision sounds like a useful feature..."
I'm aware of that. I'm just sending features that i'm using for some time now (6months?) and are quite important and makes gtimelog even more usable to me.

"""I'm not a fan of configuration options that change the interpretation of data files..."""
Feature 'subcategories_enabled' if enabled unfortunately changes interpretation of data. For me used solution seemed quite logical. IMHO category levels have to be distinguishable prior character ':' that separates category and task description is found on the line. So all category levels are at the beginning of the line - near to each other. And IMO it breaks fewer data than other notation I was able to think about.
What character separates cats levels is configurable by users. So if somebody wants to use the feature he/she can decide what character to use.
What can be improved is better integration to 'Tasks' panel - so that subcategories are tree-like unfoldable.

I added 3 configuration parameters. See some comments in settings.py:
+ """If True then timestamp of the event will be present in categorized report"""
+ report_categorized_withdate = False
+
+ """If True then treat categories with 'subcategories_separator' as multi-level categories"""
+ subcategories_enabled = False
+ """Separator for levels in multi-level categories"""
+ subcategories_separator = '_'

Defaults are set so there is no change in reports after applying patch.

It is necessary to enable features in gtimelogrc to use/see features/changes:
report_categorized_withdate = True
subcategories_enabled = True
subcategories_separator = _

See also attached file 'gtimelog-0.9.1__subcats_withdate__usage__20140102.txt' and tests:
doctest_Reports_monthly_report_categorized_with_subcats
doctest_Reports_monthly_report_categorized_with_subcats_date

"""I'm not very comfortable about passing the entire settings object to the TimeLog/Reports classes..."""
I used it this way to get an access to all available settings from one place and to me it seemed that it was easier to set tests this way. It's possible to split parameters again and pass all used settings values separately.

Revision history for this message
Standa (standa31415) wrote :

And some sample data.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

Wow, dealing with Launchpad is such a pain. I wish I'd switched to GitHub earlier. Also, can you please use '>' instead of """...""" for quoting text? Now it's a bit hard to read your reply.

Thank you for the examples. I'll take a look at the new diff when I've more free time, hopefully by the end of this week. Please ping me again if I forget.

Revision history for this message
Marius Gedminas (mgedmin) wrote :

I created a GitHub pull request and added extensive comments on the patch:
https://github.com/gtimelog/gtimelog/pull/8

Can you work with GitHub? Pretty please?

Are you familiar with git?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.