Skip to content
Merged
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
fix: #453 include customer and project id in reports
  • Loading branch information
enriquezrene committed Jul 20, 2020
commit e93ece0186f91606dd82d833be519be6fffbe159
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<th class="col sm-col">Date</th>
<th class="col sm-col">Duration</th>
<th class="col md-col">Project</th>
<th class="col lg-col">Project ID</th>
<th class="col md-col">Customer</th>
<th class="col lg-col">Customer ID</th>
<th class="col md-col">Activity</th>
<th class="col lg-col">Ticket</th>
<th class="col lg-col">Description</th>
Expand All @@ -22,6 +25,9 @@
<td class="col sm-col"> {{ entry.start_date | date: 'MM/dd/yyyy' }} </td>
<td class="col sm-col"> {{ entry.end_date | substractDate: entry.start_date }} </td>
<td class="col md-col"> {{ entry.project_name }} </td>
<td class="col md-col"> {{ entry.project_id }} </td>
<td class="col md-col"> {{ entry.customer_name }} </td>
<td class="col md-col"> {{ entry.customer_id }} </td>
<td class="col md-col"> {{ entry.activity_name }} </td>
<td class="col lg-col"> {{ entry.uri }} </td>
<td class="col lg-col multiline-col"> {{ entry.description }} </td>
Expand Down
2 changes: 2 additions & 0 deletions src/app/modules/shared/models/entry.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface Entry {
project_id?: string;
owner_email?: string;
description?: string;
customer_id?: string;
Copy link
Contributor

@juanultimate juanultimate Jul 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When are these fields going to be null or undefined (since you are defining them as optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you are creating an entry.

Copy link
Contributor

@juanultimate juanultimate Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the type used when creating time entries 👉 https://github.com/ioet/time-tracker-ui/pull/472/files#diff-bd34e3ddb205e30a185a58e351ccd04eL14 , so I think these new fields might not be optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time_entry table has the project id information, the customer info is not saved as part of it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True fact. However, from my perspective, the time_entry table is encapsulated into the API. The frontend does not ( and should not ) know about the database data structures. The frontend does ( and should ) know only about the data structures the endpoints are using ( which might be different from the database structures). In this case, the Entry model/data structure/DTO represents the payload received from the /time-entries endpoint. Therefore, the customer and project information is not going to be empty since there is no way to create an entry without specifying the project ( and thus the customer).

Copy link
Contributor

@juanultimate juanultimate Jul 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, I think we can improve this data structure using compound objects. Something like this:

interface Entry {
  id: string;
  running: boolean;
  start_date: Date;
  end_date?: Date;
  activity_id?: string;
  technologies: string[];
  uri?: string;
  project :{
    id: String
    name: String
   customer:{
      id: String
      name: String
  },
  ...... 
}

This might be done on a different issue since it should involve the backend as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, good idea

customer_name?: string;
}

export interface NewEntry {
Expand Down