provide print-out method without update for bugs
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 9 Dec 2021 13:53:53 +0000 (13:53 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 9 Dec 2021 13:53:53 +0000 (13:53 +0000)
src/budget_sync/update.py

index cfc74a5b464c27c06756a8ef53a0b7673e62b5cb..15b6f0c899d85fab4bad2194ce44cd05ce2d02c8 100644 (file)
@@ -48,7 +48,7 @@ def main():
     buglist = bz.getbugs(bugs)
     logging.info("got bugs %s" % args.bug)
     for bug in buglist:
-        print ("payees", bug.cf_payees_list)
+        print ("payees", bug.id, bug.cf_payees_list)
 
         parsed_toml = toml.loads(bug.cf_payees_list)
         print (parsed_toml)
@@ -57,14 +57,22 @@ def main():
         if isinstance(payee, int):
             payee = {'amount': payee}
 
+        modified = False
+
         if args.submitted and 'submitted' not in payee:
+            modified = True
             d = datetime.strptime(args.submitted, "%Y-%m-%d")
             payee['submitted'] = date(d.year, d.month, d.day)
 
         if args.paid and 'paid' not in payee:
+            modified = True
             d = datetime.strptime(args.paid, "%Y-%m-%d")
             payee['paid'] = date(d.year, d.month, d.day)
 
+        # skip over not modified
+        if not modified:
+            continue
+
         parsed_toml[args.user] = payee
 
         encoder = toml.encoder.TomlPreserveInlineDictEncoder()