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

[BugFix] Ensure that unset agency is recorded as null -- Production #909

Merged
merged 2 commits into from
Sep 3, 2024
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
2 changes: 1 addition & 1 deletion src/actions/process_google_analytics_results.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ProcessGoogleAnalyticsResults extends Action {
context.logger.debug("Processing GA report data");
context.processedAnalyticsData =
await this.#analyticsDataProcessor.processData({
agency: context.appConfig.agency,
agency: context.appConfig.agency ? context.appConfig.agency : null,
hostname: context.appConfig.account.hostname,
report: context.reportConfig,
data: context.rawGoogleAnalyticsReportData[0],
Expand Down
2 changes: 1 addition & 1 deletion src/process_results/analytics_data_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AnalyticsDataProcessor {
#initializeResult({ agency, report, data, query }) {
return {
name: report.name,
agency,
agency: agency ? agency : null,
sampling: data.metadata?.samplingMetadatas,
query: ((query) => {
query = Object.assign({}, query);
Expand Down
2 changes: 1 addition & 1 deletion src/publish/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class PostgresPublisher {
#rowForDataPoint({ results, dataPoint }) {
const row = this.#dataForDataPoint(dataPoint);
row.report_name = results.name;
row.report_agency = results.agency;
row.report_agency = results.agency ? results.agency : null;
return row;
}

Expand Down
2 changes: 1 addition & 1 deletion test/process_results/analytics_data_processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe("AnalyticsDataProcessor", () => {
expect(result.totals).to.be.an("object");
expect(result.totals).to.be.an("object");
expect(result.taken_at).to.be.a("date");
expect(result.agency).to.be.undefined;
expect(result.agency).to.be.null;
});

it("should return results with an empty data array if data is undefined or has no rows", () => {
Expand Down