Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Gather all logged runs in a standard date format #23

Merged
merged 6 commits into from
Sep 28, 2023
Merged

Conversation

zimeg
Copy link
Member

@zimeg zimeg commented Sep 27, 2023

Type of change

  • New sample
  • New feature
  • Bug fix
  • Documentation

Summary

This PR paginates over the running_datastore datastore to collect all logged runs and stores runs with with the ISO-8601 timestamp. Tests are also returned with a stable date to verify proper month/year wrapping when gathering past weeks.

Closes #7, fixes #22, and resolved #13.

Requirements

  • I’ve checked my submission against the Samples Checklist to ensure it complies with all standards
  • I have ensured the changes I am contributing align with existing patterns and have tested and linted my code
  • I've read and agree to the Code of Conduct

@zimeg zimeg added bug Something isn't working enhancement New feature or request update PR only - an update or maintenance is being made to an existing app labels Sep 27, 2023
@zimeg zimeg self-assigned this Sep 27, 2023
@zimeg
Copy link
Member Author

zimeg commented Sep 28, 2023

Thanks for the review @misscoded! 🚀

@zimeg zimeg merged commit ff65838 into main Sep 28, 2023
1 check passed
@zimeg zimeg deleted the test-iso-8601 branch September 28, 2023 19:33
Copy link
Member

@filmaj filmaj left a comment

Choose a reason for hiding this comment

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

Nicely done!


cursor = runs.response_metadata?.next_cursor;
items.push(...runs.items);
} while (cursor);
Copy link
Member

Choose a reason for hiding this comment

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

do/while w/ cursors in Dynamo is exactly how I structure my DDB pagination calls 👍

const isRecentRun = run.rundate >=
startOfLastWeek.toLocaleDateString("en-CA", { timeZone: "UTC" });
const isRecentRun =
run.rundate >= startOfLastWeek.toISOString().substring(0, 10);
Copy link
Member

Choose a reason for hiding this comment

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

👨‍🍳 💋

Copy link
Member Author

Choose a reason for hiding this comment

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

ISO-8601 just feels so much better 🙌 🙌

Copy link
Member

Choose a reason for hiding this comment

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

ISO8601 is the best date standard IMO

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request update PR only - an update or maintenance is being made to an existing app
Projects
None yet
3 participants