Skip to content

Commit 10998b0

Browse files
ADD: fixes for plotting
1 parent 08053a3 commit 10998b0

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# 1.2.0
22

3+
## Fixes
4+
5+
- Fix time stamps to be local time and not in 24 hour time
6+
7+
# 1.2.0
8+
39
## Enhancements
410

511
- Add toggle for dim screen - closes #7

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
"electron-google-analytics": "^0.1.0",
7474
"frappe-charts": "^1.3.0",
7575
"hot-shots": "^6.8.1",
76+
"moment": "^2.24.0",
7677
"osx-brightness": "^4.0.0",
7778
"regression": "^2.0.1",
7879
"rxjs": "^6.5.3",

src/biometrics.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { pipe } from "rxjs";
33
import { map, bufferCount, filter, share } from "rxjs/operators";
44

55
// import Analytics from "electron-google-analytics";
6+
import * as moment from "moment";
67
import * as ua from "universal-analytics";
78

89
import * as doNotDisturb from "@sindresorhus/do-not-disturb";
@@ -290,7 +291,7 @@ export function showBiometrics(
290291
notionTime += currentFlowState.timeMultiplier;
291292
notionTimes.push();
292293
realTime += 1;
293-
lastDate = new Date().toString();
294+
lastDate = moment(Date.now()).format("hh:mm:ss A");
294295
dateArray.push(lastDate);
295296
flowStates.push(currentFlowState.val);
296297

@@ -366,6 +367,7 @@ export function showBiometrics(
366367
notionTime: notionTimeStr,
367368
earthTime: earthTimeStr,
368369
paceTime: paceTimeStr,
370+
timestamp: lastDate,
369371
state: currentFlowState,
370372
score: runningAverageCalmScore,
371373
doNotDisturb: doNotDisturbEnabled

src/webview.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function getWebviewContent() {
129129
var layout = {
130130
title: 'Flow stages vs. time',
131131
xaxis: {
132-
tickformat: '%H:%M:%S'
132+
tickangle: 30
133133
},
134134
yaxis: {
135135
autotick: false,
@@ -151,11 +151,9 @@ export function getWebviewContent() {
151151
app.score = message.score;
152152
app.doNotDisturb = message.doNotDisturb;
153153
app.flowStage = message.state.str;
154-
155-
const time = new Date();
156-
157-
console.log('time', time, 'message', message);
158154
155+
const time = message.timestamp;
156+
159157
if (loadedInitDataInGraph) {
160158
let update = {
161159
x: [[time]],
@@ -170,7 +168,7 @@ export function getWebviewContent() {
170168
y: [0],
171169
mode: 'lines',
172170
line: {color: '#80CAF6'}
173-
}]
171+
}]
174172
175173
Plotly.plot('graph', data, layout, {responsive: true});
176174
}

0 commit comments

Comments
 (0)