Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
fix(activities): prevent doubling time while generating reports (#970)
Browse files Browse the repository at this point in the history
...from running activities.
  • Loading branch information
derrabauke committed Jun 12, 2023
1 parent 7c0ea1e commit 96f1a37
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/index/activities/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default class ActivitiesIndexController extends Controller {
this.showOverlappingWarning = hasOverlapping;

if (!hasUnknown && !hasOverlapping) {
this.send("generateReports");
this.generateReports();
}
}

Expand All @@ -178,18 +178,14 @@ export default class ActivitiesIndexController extends Controller {
!a.get("transferred")
)
.reduce(async (reducer, activity) => {
const duration = activity.get("duration");

if (activity.get("active")) {
duration.add(moment().diff(activity.get("from")));

await this.tracking.stopActivity.perform();
this.tracking.activity = activity;
await this.tracking.startActivity.perform();
}

const data = {
duration,
duration: activity.get("duration"),
date: activity.get("date"),
task: activity.get("task"),
review: activity.get("review"),
Expand Down

0 comments on commit 96f1a37

Please sign in to comment.