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

Feat: Added a default time frame #176

Merged
merged 6 commits into from
Oct 10, 2024
Merged

Feat: Added a default time frame #176

merged 6 commits into from
Oct 10, 2024

Conversation

Kingcedru
Copy link
Contributor

@Kingcedru Kingcedru commented Oct 7, 2024

Objective:

  • To Add a default time frame for filtering meter reads on the all reads section.

Description:

  • Add a default time frame for filtering meter reads on the all reads section.

Acceptance Criteria:

  • Added a default time frame.
  • The time frame can be customized.
  • Run tests and check if everything works well.
    • The UI project runs without any issue (doesn't cause any regression error)

@Kingcedru Kingcedru linked an issue Oct 7, 2024 that may be closed by this pull request
divinecharlotte
divinecharlotte previously approved these changes Oct 8, 2024
Copy link
Contributor

@divinecharlotte divinecharlotte left a comment

Choose a reason for hiding this comment

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

Looks good for now

@@ -31,6 +31,7 @@ export class AllMetereadsComponent implements OnInit {
dataSource: MatTableDataSource<any>;
readdata: any;

startDate: Date = new Date(new Date().setMonth(new Date().getMonth() - 1));
Copy link
Contributor

Choose a reason for hiding this comment

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

let's not add a new class property for this. We only need this value when initializing

@@ -284,7 +285,7 @@ export class AllMetereadsComponent implements OnInit {
this.externalId = result.externalId;
}

this.FilterForm.controls['start'].setValue(result.commissioningDate);
this.FilterForm.controls['start'].setValue(this.startDate);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest instead to set it to

this.FilterForm.controls['start'].setValue(result.commissioningDate || startDate);

Copy link
Contributor

Choose a reason for hiding this comment

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

We should set this date to the startDate that you have calculated as a fallback. The default behavior should be to use the commissioningDate

@musayann musayann merged commit 675307a into develop Oct 10, 2024
6 checks passed
@musayann musayann deleted the ft/default-timer branch October 10, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding default time frame to filtering meter reads
3 participants