Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Change save tracked time approach. Issue #2355 #2595

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/core/persistence/persistence.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export class PersistenceService {
const idbKey = this._getIDBKey(dbKey, projectId);
this._store.dispatch(saveToDb({ dbKey, data }));
const r = await this._databaseService.save(idbKey, data);

console.log(idbKey, data);
if (isSyncModelChange) {
this.updateLastLocalSyncModelChange();
}
Expand Down
6 changes: 4 additions & 2 deletions src/app/features/project/store/project.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
deleteTasks,
moveToArchive,
moveToOtherProject,
persistTimeTracked,
restoreTask,
updateTaskTags,
} from '../../tasks/store/task.actions';
Expand Down Expand Up @@ -81,8 +82,9 @@ export class ProjectEffects {
updateProject.type,
updateProjectAdvancedCfg.type,
updateProjectIssueProviderCfg.type,
updateProjectWorkStart.type,
updateProjectWorkEnd.type,
//updateProjectWorkStart.type,
//updateProjectWorkEnd.type,
persistTimeTracked,
addToProjectBreakTime.type,
updateProjectOrder.type,
archiveProject.type,
Expand Down
3 changes: 3 additions & 0 deletions src/app/features/simple-counter/simple-counter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { nanoid } from 'nanoid';
import { distinctUntilChanged } from 'rxjs/operators';
import { isEqualSimpleCounterCfg } from './is-equal-simple-counter-cfg.util';
import { DateService } from 'src/app/core/date/date.service';
import { persistTimeTracked } from '../tasks/store/task.actions';

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -67,6 +68,7 @@ export class SimpleCounterService {
increaseCounterToday(id: string, increaseBy: number): void {
const today = this._dateService.todayStr();
this._store$.dispatch(increaseSimpleCounterCounterToday({ id, increaseBy, today }));
this._store$.dispatch(persistTimeTracked());
}

decreaseCounterToday(id: string, decreaseBy: number): void {
Expand All @@ -76,6 +78,7 @@ export class SimpleCounterService {

toggleCounter(id: string): void {
this._store$.dispatch(toggleSimpleCounterCounter({ id }));
this._store$.dispatch(persistTimeTracked());
}

turnOffAll(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { loadAllData } from '../../../root-store/meta/load-all-data.action';
import { ImexMetaService } from '../../../imex/imex-meta/imex-meta.service';
import { IdleService } from '../../idle/idle.service';
import { DateService } from 'src/app/core/date/date.service';
import { persistTimeTracked } from '../../tasks/store/task.actions';

@Injectable()
export class SimpleCounterEffects {
Expand All @@ -46,7 +47,8 @@ export class SimpleCounterEffects {
ofType(
updateAllSimpleCounters,
setSimpleCounterCounterToday,
increaseSimpleCounterCounterToday,
// increaseSimpleCounterCounterToday,
persistTimeTracked,
setSimpleCounterCounterOn,
setSimpleCounterCounterOff,
// toggleSimpleCounterCounter,
Expand Down
6 changes: 4 additions & 2 deletions src/app/features/tag/store/tag.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
deleteTask,
deleteTasks,
moveToArchive,
persistTimeTracked,
removeTagsForAllTasks,
restoreTask,
updateTaskTags,
Expand Down Expand Up @@ -69,8 +70,9 @@ export class TagEffects {
updateTagOrder,

updateAdvancedConfigForTag,
updateWorkStartForTag,
updateWorkEndForTag,
// updateWorkStartForTag,
// updateWorkEndForTag,
persistTimeTracked,
addToBreakTimeForTag,

// TASK Actions
Expand Down
6 changes: 4 additions & 2 deletions src/app/features/tasks/store/task-db.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Actions, createEffect, ofType } from '@ngrx/effects';
import {
addSubTask,
addTask,
addTimeSpent,
// addTimeSpent,
persistTimeTracked,
convertToMainTask,
deleteTasks,
deleteTask,
Expand Down Expand Up @@ -46,7 +47,8 @@ export class TaskDbEffects {
ofType(
addTask,
restoreTask,
addTimeSpent,
// addTimeSpent,
persistTimeTracked,
unScheduleTask,
deleteTask,
deleteTasks,
Expand Down
3 changes: 3 additions & 0 deletions src/app/features/tasks/store/task.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum TaskActionTypes {
'SetCurrentTask' = '[Task] SetCurrentTask',
'SetSelectedTask' = '[Task] SetSelectedTask',
'UnsetCurrentTask' = '[Task] UnsetCurrentTask',
'PersistTimeTracked' = '[Task] PersistTimeTracked',

// Task Actions
'AddTask' = '[Task][Issue] Add Task',
Expand Down Expand Up @@ -62,6 +63,8 @@ export const setSelectedTask = createAction(

export const unsetCurrentTask = createAction(TaskActionTypes.UnsetCurrentTask);

export const persistTimeTracked = createAction(TaskActionTypes.PersistTimeTracked);

export const addTask = createAction(
TaskActionTypes.AddTask,
props<{
Expand Down
2 changes: 2 additions & 0 deletions src/app/features/tasks/task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
moveSubTaskUp,
moveToArchive,
moveToOtherProject,
persistTimeTracked,
removeTagsForAllTasks,
removeTimeSpent,
reScheduleTask,
Expand Down Expand Up @@ -236,6 +237,7 @@ export class TaskService {

pauseCurrent(): void {
this._store.dispatch(unsetCurrentTask());
this._store.dispatch(persistTimeTracked());
}

// Tasks
Expand Down