-
Notifications
You must be signed in to change notification settings - Fork 4
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
feature: Reports fields rename (M2-8268) #2002
base: develop
Are you sure you want to change the base?
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disabling eslint and TS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside the comment to disable Ts and eslint the code looks good for me.
ad926a1
to
480a4f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. Main comment is the flag is temporary. So try and minimize it's proliferation in the code to only where it's necessary. Reduces cleanup and risk later on when flag is archived and code needs to be updated to remove references to it, and where QA might not test to the same level as when the feature is first implemented. I pointed out a couple of places where this can be done.
const LEGACY_GENERAL_REPORT_NAME = 'report'; | ||
const NEW_GENERAL_REPORT_NAME = 'responses'; | ||
|
||
export const getGeneralReportName = (enableDataExportRenaming: boolean) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if capturing this condition in a function is needed. It's only called in one place (exportDataSucceed) and the use of a feature flag is temporary. Once the enableDataExportRenaming flag is archived, we'll need to remove all references (or params based on it) to it, so it's good keep this to only where this is needed. Suggest removing this function and simply determine this in exportDataSucceed
await exportTemplate({ | ||
data: reportData, | ||
fileName: GENERAL_REPORT_NAME + suffix, | ||
defaultData: reportData.length > 0 ? null : reportHeader, | ||
fileName: getGeneralReportName(enableDataExportRenaming) + suffix, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest simply determine the report name here
fileName: (enableDataExportRenaming ? NEW_GENERAL_REPORT_NAME : LEGACY_GENERAL_REPORT_NAME) + suffix,
]; | ||
|
||
export const activityJourneyHeader = [ | ||
export const getReportHeader = (enableDataExportRenaming?: boolean) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. I realize this function is also used in the tests (exportDataSucceed.test.ts
), but this function itself will likely be deleted once the flag is archived, so minimizing the use of this function in other places like the tests also make sense. Instead can you import legacyReportHeader
and newReportHeader
in the tests and compare against those values instead of relying on this function.
'response_option_selection_time', | ||
]; | ||
|
||
export const getActivityJourneyHeader = (enableDataExportRenaming?: boolean) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
@@ -1,5 +1,7 @@ | |||
/* eslint-disable @typescript-eslint/ban-ts-comment */ | |||
// @ts-nocheck | |||
import { getActivityJourneyHeader, getReportHeader } from 'shared/consts'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this import legacyReportHeader, reportHeader, legacyActivityJourneyHeader, and activityJourneyHeader instead
@@ -387,6 +435,52 @@ export const activityJourneyHeader = [ | |||
'version', | |||
]; | |||
|
|||
export const newActivityJourneyHeader = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use activityJourneyHeader
instead. One less change during flag cleanup.
fileName: GENERAL_REPORT_NAME + suffix, | ||
defaultData: reportData.length > 0 ? null : reportHeader, | ||
fileName: getGeneralReportName(enableDataExportRenaming) + suffix, | ||
defaultData: reportData.length > 0 ? null : getReportHeader(enableDataExportRenaming), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar comment as above
}); | ||
await exportTemplate({ | ||
data: activityJourneyData, | ||
fileName: JOURNEY_REPORT_NAME + suffix, | ||
defaultData: activityJourneyData.length > 0 ? null : activityJourneyHeader, | ||
defaultData: | ||
activityJourneyData.length > 0 ? null : getActivityJourneyHeader(enableDataExportRenaming), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above. Determine the headers here instead of relying on an external function that will be removed and unavailable when the flag is archived.
legacy_user_id: null, | ||
}; | ||
|
||
const newResult = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of a nit, but let's just call this result
as it is the result when the flag is on and also when it is ultimately archived. Minimizes cleanup when flag is removed.
@@ -160,8 +160,63 @@ const result = { | |||
legacy_user_id: '', | |||
}; | |||
|
|||
const newResult = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit of a nit, but let's just call this result
as it is the result when the flag is on and also when it is ultimately archived. Minimizes cleanup when flag is removed.
On it 🤓 |
fix
orfeature
branches intodevelop
orrelease
branches viaSquash and Merge
(to keep clean history)📝 Description
🔗 Jira Ticket M2-8268
Renaming & reordering for both
report.csv
andactivity_user_journey.csv
fields. Also, renamedreport.csv
toresponses.csv
.All these changes were added behind a workspace-wide feature flag, so won't be directly enabled by default.
Current expected columns & order (for
report.csv
)New expected columns & order
The changes get propagated to
activity_user_journey.csv
. Additional fields for said report were left unchanged.🪤 Peer Testing
In order to test functionality, set
enableDataExportRenaming
feature flag totrue
.✏️ Notes
Something to keep in mind is that changes to subscales will come in a separate ticket, under the same feature flag that was used for all the changes added here