Skip to content

Commit

Permalink
repair 24h strings fixes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
rksm committed Sep 14, 2019
1 parent 3c1f9bb commit 576e1fd
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# 1.0.2
## bugfixes
- fix 24 hour strings

## features
- show error message when fetch clocks fails — kinda scary looking, might need to improve UX on that.

# 1.0.1

## bugfixes
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

VERSION := 1.0.1
VERSION := 1.0.2

CLJ_FILES := $(shell find . -type f \
\( -path "./test/*" -o -path "./dev/*" -o -path "./src/*" \) \
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ and run it! (double click or from command line, see below). It will open a new b
### Emacs

<!-- *2019-08-13: MELPA package is pending, see [the melpa pull request](https://github.com/melpa/melpa/pull/6365).* -->
<!-- For the time being, emacs support can be enabled by downloading the [emacs package](https://github.com/rksm/clj-org-analyzer/releases/download/1.0.1/org-analyzer-for-emacs-1.0.1.tar.gz) directly, extracting it and adding it to your load path and require it: -->
<!-- For the time being, emacs support can be enabled by downloading the [emacs package](https://github.com/rksm/clj-org-analyzer/releases/download/1.0.2/org-analyzer-for-emacs-1.0.2.tar.gz) directly, extracting it and adding it to your load path and require it: -->
<!-- ```elisp -->
<!-- (add-to-list 'load-path "/path/to/org-analyzer-1.0.1/") -->
<!-- (add-to-list 'load-path "/path/to/org-analyzer-1.0.2/") -->
<!-- (require 'org-analyzer) -->
<!-- ``` -->
<!-- Afterwards, you can start the tool via `M-x org-analyzer-start`. -->
Expand All @@ -62,12 +62,12 @@ via `M-x org-analyzer-start`.

## Commandline

Download the latest jar as described above and start it with `java -jar org-analyzer-1.0.1.jar`.
Download the latest jar as described above and start it with `java -jar org-analyzer-1.0.2.jar`.

The following command line options are available, as per `java -jar org-analyzer-1.0.1.jar --help`:
The following command line options are available, as per `java -jar org-analyzer-1.0.2.jar --help`:

```
Usage: java -jar org-analyzer-1.0.1.jar [opt*] [org-file-or-dir*]
Usage: java -jar org-analyzer-1.0.2.jar [opt*] [org-file-or-dir*]
Interactive visualization of timetracking data (org clocks).
Expand Down
2 changes: 1 addition & 1 deletion org-analyzer-el/org-analyzer-pkg.el
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(define-package
"org-analyzer"
"1.0.1"
"1.0.2"
"org-analyzer is a tool that extracts time tracking data from org files.")
4 changes: 2 additions & 2 deletions org-analyzer-el/org-analyzer.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
;; Author: Robert Krahn <[email protected]>
;; URL: https://github.com/rksm/clj-org-analyzer
;; Keywords: calendar
;; Version: 1.0.1
;; Version: 1.0.2
;; Package-Requires: ((emacs "26"))

;; Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -44,7 +44,7 @@
(defvar org-analyzer-process-buffer nil
"The buffer for running the jar.")

(defvar org-analyzer-version "1.0.1"
(defvar org-analyzer-version "1.0.2"
"Version to sync with jar.")

(defvar org-analyzer-jar-file-name "org-analyzer.jar"
Expand Down
Binary file modified org-analyzer-el/org-analyzer.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>org.rksm</groupId>
<artifactId>org-analyzer</artifactId>
<packaging>jar</packaging>
<version>1.0.1</version>
<version>1.0.2</version>
<name>org-analyzer</name>
<description>An app that creates an interactive visualization of org-mode time-tracking data (org clockin).</description>
<url>http://github.com/rksm/clj-org-analyzer</url>
Expand Down
11 changes: 10 additions & 1 deletion src/org_analyzer/processing.clj
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@

(def timestamp-re #"([0-9]{4})-([0-9]{2})-([0-9]{2})\s+(?:\S+\s+)?([0-9]{1,2}):([0-9]{1,2})")

(defn earth-has-no-24-h+1-day
"Fix for https://github.com/rksm/clj-org-analyzer/issues/11"
[timestamp-string]
(if (s/includes? timestamp-string "24:00")
(s/replace timestamp-string "24:00" "23:59")
timestamp-string))


(defn parse-timestamp-manually [string]
(let [[_ & year-month-day-hour-min] (re-find timestamp-re string)
(let [string (earth-has-no-24-h+1-day string)
[_ & year-month-day-hour-min] (re-find timestamp-re string)
year-month-day-hour-min (map #(Integer/parseInt %) year-month-day-hour-min)]
(apply time/local-date-time year-month-day-hour-min)))

Expand Down

0 comments on commit 576e1fd

Please sign in to comment.