Skip to content

Commit d07db70

Browse files
authored
Tta 50 error when editing an entry (#907)
* fix: TTA-50 Error when editing an entry * fix: TTA-50 Error when editing an entry
1 parent c21ed5a commit d07db70

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/app/modules/shared/components/details-fields/details-fields.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
(search)="onClearedComponent($event)"
2222
(change)="onSelectedProject($event)"
2323
ngDefaultControl="project_name">
24-
24+
2525
<ng-template ng-option-tmp let-item="item">
2626
<div class="flex flex-wrap flex-row justify-between">
2727
<div class="p-2 text-xs">

src/app/modules/shared/components/details-fields/details-fields.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { TechnologyState } from '../../store/technology.reducers';
2222
import { EntryActionTypes } from './../../../time-clock/store/entry.actions';
2323
import { SaveEntryEvent } from './save-entry-event';
2424
import { ProjectSelectedEvent } from './project-selected-event';
25-
import { get } from 'lodash';
25+
import { get, isEmpty } from 'lodash';
2626
import { DATE_FORMAT, DATE_FORMAT_YEAR } from 'src/environments/environment';
2727
import { TechnologiesComponent } from '../technologies/technologies.component';
2828
import { MatDatepicker } from '@angular/material/datepicker';
@@ -179,7 +179,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
179179
this.goingToWorkOnThis = this.entryToEdit?.running ? true : false;
180180
this.shouldRestartEntry = false;
181181
this.getRecentProjects();
182-
if (this.entryToEdit) {
182+
if (this.entryToEdit && !isEmpty(this.entryToEdit)) {
183183
this.isTechnologiesDisabled = false;
184184
this.selectedTechnologies = this.entryToEdit.technologies;
185185
const projectFound = this.listProjects.find((project) => project.id === this.entryToEdit.project_id);

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class TimeEntriesComponent implements OnInit, OnDestroy, AfterViewInit {
113113
editEntry(entryId: string) {
114114
this.entryId = entryId;
115115
this.store.pipe(select(getTimeEntriesDataSource)).subscribe(ds => {
116-
this.entry = ds.data.find((entry) => entry.id === entryId);
116+
this.entry = {... ds.data.find((entry) => entry.id === entryId)};
117117
this.canMarkEntryAsWIP = this.isEntryRunningEqualsToEntryToEdit(this.getEntryRunning(ds.data), this.entry)
118118
|| this.isTheEntryToEditTheLastOne(ds.data);
119119
});

0 commit comments

Comments
 (0)