Skip to content

Commit

Permalink
Reduce date range for API reports to speed up processing
Browse files Browse the repository at this point in the history
  • Loading branch information
levinmr committed Aug 23, 2024
1 parent 19d29a5 commit abda0d0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ jobs:
needs:
- lint
- test
if: github.ref == 'refs/heads/bugfix/backload_ga4_api_data'
uses: 18F/analytics-reporter/.github/workflows/deploy.yml@bugfix/backload_ga4_api_data
if: github.ref == 'refs/heads/develop'
uses: 18F/analytics-reporter/.github/workflows/deploy.yml@develop
with:
ANALYTICS_GA4_CALL_RETRY_COUNT: ${{ vars.ANALYTICS_GA4_CALL_RETRY_COUNT_DEV }}
ANALYTICS_KEY_FILE_NAME: ${{ vars.ANALYTICS_KEY_FILE_NAME }}
Expand Down
7 changes: 4 additions & 3 deletions deploy/backload.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ const api_run = () => {
const iterationTargetDate = subDays(new Date(), totalDaysAgo);

const iterationDaysAgo = differenceInDays(today, iterationTargetDate) + 1;
const modifiedApiJsonString = JSON.stringify(apiReports)
.replaceAll('"yesterday"', `"${iterationDaysAgo}daysAgo"`)
.replaceAll('"3daysAgo"', `"${iterationDaysAgo}daysAgo"`);
const modifiedApiJsonString = JSON.stringify(apiReports).replaceAll(
'"yesterday"',
`"${iterationDaysAgo}daysAgo"`,
);

fs.unlinkSync("reports/api.json");
fs.writeFileSync("reports/api.original.json", JSON.stringify(apiReports));
Expand Down
26 changes: 13 additions & 13 deletions reports/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -67,7 +67,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -115,7 +115,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -163,7 +163,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -211,7 +211,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -267,7 +267,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -318,7 +318,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -369,7 +369,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -425,7 +425,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -476,7 +476,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -524,7 +524,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -582,7 +582,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down Expand Up @@ -639,7 +639,7 @@
],
"dateRanges": [
{
"startDate": "3daysAgo",
"startDate": "yesterday",
"endDate": "yesterday"
}
],
Expand Down

0 comments on commit abda0d0

Please sign in to comment.