-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
dev/core#4031 Export dates from SearchKit to spreadsheet in SQL format #26211
dev/core#4031 Export dates from SearchKit to spreadsheet in SQL format #26211
Conversation
No issue was found matching the number given in the pull request title. Please check the issue number. |
(Standard links)
|
This is definitely the functionality we want, but I'm concerned the code might be better placed in |
@colemanw I hear you, that would be cleaner. But by the time we're in But it's not unlikely that I'm missing an obvious cleaner option - welcome any thoughts you have on a better approach. |
@colemanw How about something like this that keeps it all in |
I'll update the tests if this makes sense. |
* @return array|string | ||
*/ | ||
protected function formatViewValue($key, $rawValue, $data) { | ||
protected function formatViewValue($key, $rawValue, $data, $dataType = NULL) { |
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 is the purpose of this new param $dataType
? I don't see it ever being passed into either this function nor Download:: formatViewValue
.
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.
This is so that Download::formatViewValue
can pass the result of $this->getSelectExpression($key)['dataType']
to AbstractRunAction::formatViewValue
, so we don't have to do it twice for every row we download. Just thought if we're downloading 10k rows, maybe we want to avoid redundant steps.
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.
Ok, following the code to $this->getSelectExpression($key)
it looks pretty efficient, it's just grabbing the value from a cached array. I don't think you're gaining any performance there, but I could see it as a code simplification if you make the $dataType
param required and do not look it up within this function at all.
f1e0449
to
b30ce8d
Compare
b30ce8d
to
dbc32dc
Compare
Current revision looks great. Thanks for your work on this @larssandergreen - nice job! |
Great, thanks @colemanw for your help on this. |
Before
From SearchKit Download Spreadsheet, dates are formatted in Complete Date and Time format. The default for this format is not readily recognized as a date in spreadsheets.
After
Dates are formatted in SQL DATETIME or DATE format for csv, xlxs and ods downloads. No change in pdfs, SearchKit itself or for dates that have been re-written in a Display.