-
Notifications
You must be signed in to change notification settings - Fork 34
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
Fix date format in csv files #148
Fix date format in csv files #148
Conversation
Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
2dbbf93
to
89e0a07
Compare
The data used to test is the following, also have attached the csv report generated using it
|
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.
The output CSV is still posting all days as Jan 01.
_index,_id,_version,_score,_source.key1.key11,_source.key1.key12,_source.key1.key13,_source.key2,_source.key3,_source.a.b.c
test_index3,test,1,1,value11,01/01/2023,01/01/2023,01/01/2023,value3,01/01/2023
I am going to strongly recommend you include the recommendations in issue #196.
Since the fix of this code is this far off the mark, the refactor recommended should take less than a day, and will improve testability and readability and help in debugging the issue at hand.
I added the wrong csv file, can you check this one? |
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.
could you update unit tests to cover this fix?
Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
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.
some questions
{ | ||
customer_birth_date: '2023-04-26T04:34:32Z', | ||
order_date: '2023-04-26T04:34:32Z', | ||
'products.created_on': '2023-04-26T04:34:32Z', | ||
} |
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.
what does adding this do?
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.
the previous hit data was missing required date fields and a field object which consists of all date fields from backend. This data is required for the test to pass. Currently this fields object is being sent from backend, so while mocking the hits, we need to also include field object as well. Adding a current format for example
{
_index: 'test_index3',
_id: 'test',
_version: 1,
_score: 1,
_source: {
key1: {
key11: 'value11',
key12: '2023-04-26T04:34:32Z',
key13: '2023-04-26T04:34:32Z'
},
key2: '2023-04-21T04:34:32Z',
key3: 'value3',
a: { b: [Object] }
},
fields: {
'key1.key12': [ '2023-04-26T04:34:32.000' ],
'key1.key13': [ '2023-04-26T04:34:32.000' ],
key2: [ '2023-04-21T04:34:32.000' ],
'a.b.c': [ '2023-07-21T18:40:01.000' ]
}
}
@@ -526,7 +1369,6 @@ test('create report with empty/one/multiple(list) date values', async () => { | |||
undefined, | |||
mockLogger | |||
); | |||
|
|||
expect(dataUrl).toEqual( | |||
'category,customer_gender,order_date\n' + | |||
'c1,Ma,[]\n' + |
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.
why the expected data didn't change with the test input change?
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.
because we aren't checking all the date fields available in all tests, just the ones we need, so the expected data isn't modified but for the function to work as expected, all date value fields should be included in the hits.
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.
thanks
'products.created_on': '2023-04-26T04:34:32Z', | ||
} | ||
), | ||
// }), |
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.
minor: can remove this comment and one line 922
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.
done
fieldDateValue.length !== 0 && | ||
fieldDateValue instanceof Array | ||
) { | ||
console.log('entered'); |
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.
minor: can remove the console log from here.
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.
done
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files --------- (cherry picked from commit 93a8704) Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files * covered all test cases * add index * fixed jest tests * remove commented code * remove commented line and console log --------- (cherry picked from commit 93a8704) Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704)
* Fix date format in csv files * covered all test cases * add index * fixed jest tests * remove commented code * remove commented line and console log --------- (cherry picked from commit 93a8704) Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Fix date format in csv files (#148) * Fix date format in csv files Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * covered all test cases Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * add index Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * fixed jest tests Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented code Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> * remove commented line and console log Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> --------- Signed-off-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com> (cherry picked from commit 93a8704) * update snapshots to fix CIs Signed-off-by: Eric <menwe@amazon.com> --------- Signed-off-by: Eric <menwe@amazon.com> Co-authored-by: Kavitha Conjeevaram Mohan <mohakavi@amazon.com>
Description
Date format of nested fields are modified according to advanced settingsDate format of nested fields according to advanced settings
Issues Resolved
#106
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.