From 61f47bb1be72d7b7b935a7d3159024e44854e8f2 Mon Sep 17 00:00:00 2001 From: "Christian G. Warden" Date: Thu, 26 Jun 2014 14:09:16 -0700 Subject: [PATCH] Fix duplication of tags when ditto is used When using ditto response ("), don't add autotags or tags from the task file. Fixes duplication of tags each time ditto is used. --- ping.pl | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/ping.pl b/ping.pl index 6ecebfc..f2220d1 100755 --- a/ping.pl +++ b/ping.pl @@ -108,30 +108,31 @@ # a pair of double-quotes means "ditto", and acts as if we entered # the last thing that was in our TagTime log file. - $resp = $last_doing; - } - - # refetch the task numbers from task file; they may have changed. - if(-e $tskf) { - if(open(F, "<$tskf")) { - %tags = (); # empty the hash first. - while() { - if(/^\-{4,}/ || /^x\s/i) { last; } - if(/^(\d+)\s+\S/) { $tags{$1} = gettags($_); } + $tagstr = $last_doing; + $comments = ""; + } else { + # refetch the task numbers from task file; they may have changed. + if(-e $tskf) { + if(open(F, "<$tskf")) { + %tags = (); # empty the hash first. + while() { + if(/^\-{4,}/ || /^x\s/i) { last; } + if(/^(\d+)\s+\S/) { $tags{$1} = gettags($_); } + } + close(F); + } else { + print "ERROR: Can't read task file ($tskf) again\n"; + $eflag++; } - close(F); - } else { - print "ERROR: Can't read task file ($tskf) again\n"; - $eflag++; } - } - $tagstr = trim(strip($resp)); - $comments = trim(stripc($resp)); - $tagstr =~ s/\b(\d+)\b/($tags{$1} eq "" ? "$1" : "$1 ").$tags{$1}/eg; - $tagstr =~ s/\b(\d+)\b/tsk $1/; - $tagstr .= $autotags; - $tagstr =~ s/\s+/\ /g; + $tagstr = trim(strip($resp)); + $comments = trim(stripc($resp)); + $tagstr =~ s/\b(\d+)\b/($tags{$1} eq "" ? "$1" : "$1 ").$tags{$1}/eg; + $tagstr =~ s/\b(\d+)\b/tsk $1/; + $tagstr .= $autotags; + $tagstr =~ s/\s+/\ /g; + } $a = annotime("$t $tagstr $comments", $t)."\n"; } while($tagstr ne "" && ($enforcenums && ($tagstr !~ /\b(\d+|non|afk)\b/) ||