From 79440b70fff9794db1df6d77071260b25de18f29 Mon Sep 17 00:00:00 2001 From: flight16 Date: Sat, 23 May 2015 15:19:48 +0900 Subject: [PATCH] Fix: DayOne mixed-case tags don't work When filtering on DayOne tags that contain upper case, no entries are returned. maebert/jrnl#354 --- .../entries/044F3747A38546168B572C2E3F217FA2.doentry | 2 +- features/regression.feature | 9 +++++++++ jrnl/DayOneJournal.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/features/data/journals/dayone.dayone/entries/044F3747A38546168B572C2E3F217FA2.doentry b/features/data/journals/dayone.dayone/entries/044F3747A38546168B572C2E3F217FA2.doentry index 2bb8e3c3..1ac26242 100644 --- a/features/data/journals/dayone.dayone/entries/044F3747A38546168B572C2E3F217FA2.doentry +++ b/features/data/journals/dayone.dayone/entries/044F3747A38546168B572C2E3F217FA2.doentry @@ -24,7 +24,7 @@ Tags work - play + PLaY Time Zone America/Los_Angeles diff --git a/features/regression.feature b/features/regression.feature index 102566b2..727f7c27 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -69,3 +69,12 @@ Feature: Zapped bugs should stay dead. 2014-04-24 09:00 Ran 6.2 miles today in 1:02:03. | I'm feeling sore because I forgot to stretch. """ + + Scenario: DayOne tag searching should work with tags containing a mixture of upper and lower case. + # https://github.com/maebert/jrnl/issues/354 + Given we use the config "dayone.yaml" + When we run "jrnl @plAy" + Then the output should contain + """ + 2013-05-17 11:39 This entry has tags! + """ diff --git a/jrnl/DayOneJournal.py b/jrnl/DayOneJournal.py index a3e53826..1ecd0bb6 100644 --- a/jrnl/DayOneJournal.py +++ b/jrnl/DayOneJournal.py @@ -53,7 +53,7 @@ class DayOne(Journal.Journal): title, body = (raw[:sep.end()], raw[sep.end():]) if sep else (raw, "") entry = Entry.Entry(self, date, title, body, starred=dict_entry["Starred"]) entry.uuid = dict_entry["UUID"] - entry.tags = [self.config['tagsymbols'][0] + tag for tag in dict_entry.get("Tags", [])] + entry.tags = [self.config['tagsymbols'][0] + tag.lower() for tag in dict_entry.get("Tags", [])] self.entries.append(entry) self.sort()