Created
November 8, 2015 11:31
-
-
Save udoschneider/116382a58e23ebd1b6f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"https://flow.polar.com/activity/data/1.6.2015/6.12.2015" | |
json := Clipboard clipboardText. | |
data := NeoJSONReader on: json readStream. | |
data := data next at: 'data'. | |
sleep := Dictionary new. | |
data reverse collect: [:each | | |
|summary sleepTime | | |
summary := (each at: 'summaries') at: 1. | |
ts := (DateAndTime fromString: (summary at: 'datetime')) asDate. | |
sleepTime := ((((summary at: 'sleepTime') / 1000 / 60 / 60) asFloat * 10) rounded / 10) asFloat. | |
ts -> sleepTime | |
]. | |
sleep. | |
(Date year: 2001 month: 1 day: 1) + (388736855 / (24 * 60 * 60)) days |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment