GTG

Merge lp:~ethcelon-deactivatedaccount/gtg/bugfix into lp:~gtg/gtg/old-trunk

Proposed by om bhallamudi
Status: Rejected
Rejected by: Izidor Matušov
Proposed branch: lp:~ethcelon-deactivatedaccount/gtg/bugfix
Merge into: lp:~gtg/gtg/old-trunk
Diff against target: 65 lines (+25/-9)
1 file modified
GTG/plugins/hamster/hamster.py (+25/-9)
To merge this branch: bzr merge lp:~ethcelon-deactivatedaccount/gtg/bugfix
Reviewer Review Type Date Requested Status
Parin Porecha Pending
Review via email: mp+208776@code.launchpad.net

This proposal supersedes a proposal from 2014-02-27.

Description of the change

Proposed fix for bug Bug #963891 ( Tags are changed to all-lower-case while conversion to hamster activity Edit )

To post a comment you must log in.
Revision history for this message
Parin Porecha (parinporecha) wrote : Posted in a previous version of this proposal

Hi Om,

I have looked at your patch, and it looks like it will solve the bug.

A couple of nitpicks -

Line 23 of the diff does not make sense (You changed the dictionary to hold the same string as a key and it's value).
Line 14 of the diff does not convert hamster activities to lowercase anymore. This may lead to tags like - @Home, @HOME, @home. We don't want that. If we found a variant of gtg tag already in hamster, we use that instead.

So, please change your logic to compare lowercase tags of both GTG and Hamster but use the original tag.
I'll test and review the patch after you make these changes.

review: Needs Fixing
Revision history for this message
om bhallamudi (ethcelon-deactivatedaccount) wrote : Posted in a previous version of this proposal

Hi Parin
About Line 24 of the diff, GTG itself considers @HOME @Home and @home as different tags, so isn't it natural that when we start a hamster task we might want to differentiate between them?

Revision history for this message
Parin Porecha (parinporecha) wrote : Posted in a previous version of this proposal

Yes, GTG considers those tags different, but we will be changing that.

You see sometimes we can type a wrong case by mistake. It is very
irritating to go back to the editor, select that tag and change that
particular letter. Now, we will be changing all the tags by default to
lowercase so that situations like these do not happen.
Since you're already working on fixing a similar bug, it is better to merge
a patch that will not be needed to get changed again after sometime.

Another reason -
Hamster also considers @Home, @HOME as different. Now, you take both GTG's
tags and Hamster's tags and add them. You get a big assorted combination of
5-6 tags which are different whereas the meaning behind all of them is only
one and that is - home.

On Thu, Feb 27, 2014 at 10:53 PM, om bhallamudi <email address hidden>wrote:

> Hi Parin
> About Line 24 of the diff, GTG itself considers @HOME @Home and @home as
> different tags, so isn't it natural that when we start a hamster task we
> might want to differentiate between them?
>
> --
> https://code.launchpad.net/~om-bhallamudi/gtg/bugfix/+merge/208634
> You are reviewing the proposed merge of lp:~om-bhallamudi/gtg/bugfix into
> lp:gtg.
>

--
Regards,
Parin Porecha

GTG Developer
GNOME Foundation Member
Github <https://github.com/parinporecha/> |
Launchpad<https://launchpad.net/~parinporecha>
 | Gnome Bugzilla<https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=parinporecha%40gmail.com><https://bugzilla.gnome.org/page.cgi?id=describeuser.html&login=parinporecha%40gmail.com>
 | Ohloh <https://www.ohloh.net/accounts/parinporecha>

Revision history for this message
om bhallamudi (ethcelon-deactivatedaccount) wrote : Posted in a previous version of this proposal

I have added the following functionality:
If we have a similar tag in hamster while adding a task from GTG, we use the tag which is already present in hamster
Else, we use the lower case of whatever tag we give the task in GTG, keeping in mind the fact that all tags are being switched to lower case.

Revision history for this message
Izidor Matušov (izidor) wrote :

GTG moved the primary code hosting over to Github: https://github.com/getting-things-gnome

If your patch is still relevant and you would like to get it merged, create a pull request on github against branch https://github.com/getting-things-gnome/gtg

Unmerged revisions

1361. By om bhallamudi

bugfix for #963891

1360. By om bhallamudi

bugfix for #963891, removed some debug statements and made the variable names more clear

1359. By om bhallamudi

bugfix for #963891

1358. By om bhallamudi

bugfix for #963891

1357. By om bhallamudi

hamster plugin fix: bug #963891

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'GTG/plugins/hamster/hamster.py'
2--- GTG/plugins/hamster/hamster.py 2014-01-12 07:15:09 +0000
3+++ GTG/plugins/hamster/hamster.py 2014-02-28 11:36:44 +0000
4@@ -72,7 +72,7 @@
5 if task is None:
6 return
7 gtg_title = task.get_title()
8- gtg_tags = [t.lstrip('@').lower() for t in task.get_tags_name()]
9+ gtg_tags = [t.lstrip('@') for t in task.get_tags_name()]
10
11 activity = "Other"
12 if self.preferences['activity'] == 'tag':
13@@ -91,8 +91,7 @@
14 category = ""
15 if self.preferences['category'] == 'auto_tag':
16 hamster_activities = dict([(str(x[0]), unicode(x[1]))
17- for x in
18- self.hamster.GetActivities('')])
19+ for x in self.hamster.GetActivities('')])
20 if (gtg_title in hamster_activities
21 or gtg_title.replace(",", "") in hamster_activities):
22 category = "%s" % hamster_activities[gtg_title]
23@@ -117,19 +116,36 @@
24 description = task.get_excerpt(strip_tags=True,
25 strip_subtasks=True)
26
27- tag_candidates = []
28+
29 try:
30+ hamster_tags = [str(x[1]) for x in self.hamster.GetTags(False)]
31+ lower_gtg_tags = [x.lower() for x in gtg_tags]
32+ existing_tags = []
33+ for tag in hamster_tags:
34+ if tag.lower() in lower_gtg_tags:
35+ existing_tags.append(tag)
36+
37+
38 if self.preferences['tags'] == 'existing':
39- hamster_tags = set([str(x[1]) for x in
40- self.hamster.GetTags(False)])
41- tag_candidates = list(hamster_tags.intersection(set(gtg_tags)))
42+ tag_candidates = existing_tags
43+
44 elif self.preferences['tags'] == 'all':
45- tag_candidates = gtg_tags
46+ tag_candidates = existing_tags
47+ lower_hamster_tags = [x.lower() for x in hamster_tags]
48+ new_tags = []
49+
50+ for tag in gtg_tags:
51+ if tag.lower() not in lower_hamster_tags:
52+ new_tags.append(tag.lower())
53+
54+ tag_candidates = (set(tag_candidates).union(new_tags))
55+
56+
57 except dbus.exceptions.DBusException:
58 # old hamster version, doesn't support tags
59 pass
60 tag_str = "".join([" #" + x for x in tag_candidates])
61-
62+
63 # Format of first argument of AddFact -
64 # `[-]start_time[-end_time] activity@category, description #tag1 #tag2`
65 fact = activity

Subscribers

People subscribed via source and target branches

to status/vote changes: