File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -158,6 +158,7 @@ export class RemoveObsoleteMappingsJob extends SyncJob {
158158 } else {
159159 const service = SyncedServiceCreator . create ( primaryServiceDefinition )
160160 const relatedTimeEntriesFromApi = await service . getTimeEntriesRelatedToMappingObjectForUser ( mapping , this . _user ) ;
161+ //User doesnt have to have time entries - so this if doesnt really make sense
161162 if ( ! relatedTimeEntriesFromApi ) {
162163 operationsOk = false ;
163164 if ( service . errors . length > 0 ) {
Original file line number Diff line number Diff line change @@ -373,25 +373,26 @@ export class TogglTrackSyncedService implements SyncedService {
373373 return entries ;
374374 }
375375
376+
376377 async replaceTimeEntryDescription ( timeEntry : ServiceTimeEntryObject , tagName : number | string ) : Promise < void > {
377378 const start = new Date ( ) ;
378379 start . setMonth ( start . getMonth ( ) - 6 ) ;
379380 const timeEntryFromApi = await this . getTimeEntryById ( timeEntry . id , start ) ;
380381
381- if ( timeEntryFromApi === null ) {
382- return ;
382+ if ( timeEntryFromApi === null || timeEntryFromApi . text . includes ( tagName . toString ( ) ) ) {
383+ return ;
383384 }
384385
385386 const body =
386387 [
387388 { 'op' : 'replace' ,
388389 'path' : '/description' ,
389- 'value' : timeEntryFromApi != null ? timeEntryFromApi ? .text + ` ${ tagName } ` : ` ${ tagName } `
390+ 'value' : timeEntryFromApi ? .text + ` ${ tagName } `
390391 }
391392 ]
392393 ;
393- const teStart = new Date ( timeEntryFromApi . start ) . toISOString ( ) ;
394394
395+ const teStart = new Date ( timeEntryFromApi . start ) . toISOString ( ) ;
395396 await this . _retryAndWaitInCaseOfTooManyRequests (
396397 superagent
397398 . patch ( `${ this . _workspacesTimeEntriesUri } /${ timeEntry ?. id } ` )
You can’t perform that action at this time.
0 commit comments