Commit graph

1650 commits

Author SHA1 Message Date
Shaun Ruffell
3ec09f9be1 getOverlaps should use non-empty range filter
We can eliminate the need to parse the entire database if we only look for
overlaps based on the latest interval.

Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
9c0c27b55b getLatestInterval does not need to walk all the inclusions
This does not appear to be necessary anymore given that the database lines are
generated from intervals and are all well formed. Any open interval *should* be
at the end of the database.

Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
86bb1465e8 getTracked does not need to read in entire database
Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
e9f860d8ce Remove call to getAllInclusions when initializing tag database 2020-01-17 17:48:57 +01:00
Shaun Ruffell
cf8c35ad55 intervalSummarize should not load the entire database
intervalSummarize is called at the end of most commands. The cost of parsing
all the lines in the database can be significant as the size of the database
grows.

Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
6af1101ea2 Database: Use reverse iterator in lastLine
Now that we have the iterators, we can standardize on their use.

Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
557fd4cb34 Database: Add forward/reverse iterator
This allows the database to be treated as a single collection of strings, but
can be used to avoid loading the entire database when only interested in recent
entries.

Related to issue #245.
2020-01-17 17:48:57 +01:00
Shaun Ruffell
ea3bbd0e85 Datafile: allLines() can return const reference instead of copy.
Not only does this eliminate the need to copy the stings to the caller, it will
also eliminate the need for any iterators over the entries in the Database from
having to hold a copy of the lines from the Datafile.

Related to #245.
2020-01-17 17:48:57 +01:00
Thomas Lauf
03ffa70203 Add curly brackets
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-27 16:10:46 +01:00
Thomas Lauf
30740af3ba Resharpen error message for if command stop gets called with ids
- Amends #270

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-12-27 16:10:46 +01:00
Shaun Ruffell
145af6603c Stop with id should suggest modify command
Recently I was trying to stop an interval that I had left open over the
weekend, but I had already started a new interval at the beginning of the
week. The error I was received was "The end of a date range must be after the
start." which was confusing to me.

After a few moments I realized I should have been using the modify command.
Now the stop command will suggest modify if someone attempts to use stop for
this purpose.
2019-12-27 15:47:39 +01:00
Thomas Lauf
400d02aedb Reduce upper limit for exclusion calculation to current datetime
- `Datetimee("tomorrow")` can create extra exclusion ahead of current time
  which in turn create erroneous synthetic intervals
- Fixes #260

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-11-20 06:55:43 +01:00
Shaun Ruffell
8109c155af #220: Handle escaped quotes in tags database file.
If there are escaped quotes in the tags database file, when the file is read,
then written, additional escape characters were inserted.

For example:

When tag 'a "test"' is written, it gets stored as 'a \"test\"'. Then it's read
back in that form, but the next time it's serialized to disk, the quotes would
be escaped again resulting in 'a \\"test\\"' which has the effect of removing
the escapes for the double-quotes.
2019-11-18 06:43:21 +01:00
Shaun Ruffell
5f5cfb7b0f #254: quotes in annotations are not escaped
Escapes the quotes for the annotations in the data file, and when
converting an interval to JSON.

The quotes in the annotations were already dequoted in
IntervalFactory::fromSerialization, so we only needed to quote the strings
when serializing or dumping to JSON.
2019-11-18 06:43:21 +01:00
Thomas Lauf
e15fcd30d0 Update copyright holders
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-10-18 10:59:16 +02:00
Thomas Lauf
d64017a7a6 Update copyright dates
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-10-18 10:59:16 +02:00
Thomas Lauf
cd0d5d175e Update libshared to 0d4e31de757ea2609a82549c5b09703d3d3fbe16
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-09-06 16:17:22 +02:00
Thomas Lauf
e6b5a14927 Extend command 'annotate' to remove annotation
- Closes #247

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-08-24 23:57:30 +02:00
Thomas Lauf
57f9982fd1 Throw error message if start date is earlier than open interval
Closes #240

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-08-02 17:54:08 +02:00
Thomas Lauf
6e855cc998 Drop internal help for man pages
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-06-21 23:32:11 +02:00
Thomas Lauf
f72c4fda52 Extract class Journal from class Database
- const-ify Transaction and UndoAction
- Clang-tidying
2019-06-19 18:05:44 +02:00
Thomas Lauf
b15cddd562 Create tag database from existing interval database on startup
- Closes #224

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-06-08 23:00:57 +02:00
Thomas Lauf
993ecd5ec0 Update libshared to eadeda5d170bb513e52cf1a00ec2cc9501077bbf
- Import fix for #228
2019-06-08 21:00:16 +02:00
Thomas Lauf
55370ea86c Show message if no data within given range
- Closes #191

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-05-28 22:51:57 +02:00
Thomas Lauf
8256b5e625 Removing a stray space char
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-05-28 21:17:26 +02:00
Thomas Lauf
037550b791 '-h' should show help
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-05-18 18:40:26 +02:00
Thomas Lauf
6bb4f981cb Merge branch '212-fix-help-handling' of git://github.com/sruffell/timewarrior into sruffell-212-fix-help-handling 2019-05-07 22:08:23 +02:00
Thomas Lauf
d39af37db2 Update libshared to 4178b49db1c5fed5006a4ab6aa2df3f9937f770b
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-05-03 17:04:07 +02:00
Thomas Lauf
ba9cfc95b9 Rename variables
- for better readability

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-12 16:13:39 +02:00
Thomas Lauf
297d9e3c19 Remove comments
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-12 15:49:05 +02:00
Thomas Lauf
920e3b4019 Add field reference_hour, extract determination of color for hour label
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 23:13:41 +02:00
Thomas Lauf
a6b9e4204c Use fields directly instead of passing them as function parameters
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 22:43:27 +02:00
Thomas Lauf
0510b59460 Make cell width a field
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 22:23:48 +02:00
Thomas Lauf
186dd8e3de Fix padding for determined hour range (+1h before and after)
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 16:39:28 +02:00
Thomas Lauf
36d7b6f387 Consider open track only until reference datetime when determining hour range
- Close #107

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 16:39:28 +02:00
Thomas Lauf
b3799ede03 Use early return
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 16:07:57 +02:00
Thomas Lauf
6f439097d6 Make use of a default value
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 10:46:39 +02:00
Thomas Lauf
a672fd0647 Apply exclusions to open interval only within range within interval start and now
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-11 10:42:08 +02:00
Thomas Lauf
daec6b1fae Clean up .gitignore files
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-10 12:08:42 +02:00
Thomas Lauf
ea9a5e341e Make parameter 'configuration' a const reference
- Clang-Tidy: The parameter 'configuration' is copied for each invocation but only used as a const reference;

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-10 12:02:07 +02:00
Thomas Lauf
42cb7273cd Inject reference datetime (= now) into chart
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-10 12:00:25 +02:00
Thomas Lauf
b4a15b3c84 Use internal fields color_today and color_holiday in getDayColor
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-09 16:23:37 +02:00
Thomas Lauf
9fcadaee1c Reorder and group function declarations
Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
2019-04-09 16:23:37 +02:00
Thomas Lauf
58c392b0b9 Move color definitions into configuration 2019-04-09 16:23:37 +02:00
Thomas Lauf
4ef248b973 Extract more parameters into chart configuration 2019-04-09 16:23:37 +02:00
Thomas Lauf
e2bd076357 Extract chart configuration into separate class 2019-04-09 16:23:37 +02:00
Thomas Lauf
40ea90c000 Update libshared 2019-04-09 16:23:37 +02:00
Shaun Ruffell
c76d004897 #212: "--help" should show help, not considered to be a tag.
This change makes any instance of '--help' on the command line to be made the
command for this particular invocation.
2019-04-07 16:48:24 -05:00
Thomas Lauf
747d560630 Use dynamic_cast instead of static_cast to downcast from a base to a derived class 2019-02-26 22:22:21 +01:00
Thomas Lauf
04adb50480 Add curly braces 2019-02-26 22:20:06 +01:00