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

fix: Bad date type in email text report for table chart #20119

Merged

Conversation

codemaster08240328
Copy link
Contributor

SUMMARY

When creating a report that sends a table chart with dates, and choose the option send by email as text, the dates show badly formatted

It is because /api/v1/chart/data endpoint returns datetime64 data which represents as milliseconds.

Need to convert is as date type when we create pandas Dataframe from the result data.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE:
image

AFTER:
image

TESTING INSTRUCTIONS

  1. Create a table chart which contains date.
  2. Create a text email report.
  3. Check your email.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #20119 (ed195a6) into master (c8fe518) will increase coverage by 0.07%.
The diff coverage is 65.26%.

❗ Current head ed195a6 differs from pull request most recent head 8ac748f. Consider uploading reports for the commit 8ac748f to get more accurate results

@@            Coverage Diff             @@
##           master   #20119      +/-   ##
==========================================
+ Coverage   66.47%   66.55%   +0.07%     
==========================================
  Files        1727     1729       +2     
  Lines       64724    64936     +212     
  Branches     6822     6794      -28     
==========================================
+ Hits        43024    43216     +192     
- Misses      19969    19992      +23     
+ Partials     1731     1728       -3     
Flag Coverage Δ
hive ?
mysql 82.41% <ø> (+0.25%) ⬆️
postgres 82.48% <ø> (+0.26%) ⬆️
presto ?
python 82.56% <ø> (-0.09%) ⬇️
sqlite 82.27% <ø> (+0.31%) ⬆️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...art-controls/src/operators/contributionOperator.ts 100.00% <ø> (ø)
...art-controls/src/sections/annotationsAndLayers.tsx 100.00% <ø> (ø)
.../shared-controls/components/RadioButtonControl.tsx 0.00% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <ø> (ø)
...ui-core/src/chart/components/FallbackComponent.tsx 100.00% <ø> (ø)
.../superset-ui-core/src/query/types/QueryFormData.ts 100.00% <ø> (ø)
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <ø> (ø)
...egacy-plugin-chart-event-flow/src/controlPanel.tsx 14.28% <0.00%> (ø)
...ugins/legacy-plugin-chart-sunburst/src/Sunburst.js 0.00% <0.00%> (ø)
...gins/legacy-plugin-chart-world-map/src/WorldMap.js 0.00% <0.00%> (ø)
... and 376 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8fe518...8ac748f. Read the comment docs.

@yousoph yousoph closed this Jun 1, 2022
@yousoph yousoph reopened this Jun 1, 2022
@yousoph
Copy link
Member

yousoph commented Jun 1, 2022

/testenv up

@github-actions
Copy link
Contributor

github-actions bot commented Jun 1, 2022

@yousoph Ephemeral environment spinning up at http://34.219.71.53:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

@rusackas
Copy link
Member

rusackas commented Jun 3, 2022

@eschutho do you have a convenient means of testing this PR? Not sure how to test on the ephemeral envs.

Copy link
Member

@AAfghahi AAfghahi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, do you mind writing a test where it converts the datetime?

@eschutho
Copy link
Member

@rusackas unfortunately, no, we can't test reports on ephemeral but I can pull it down locally and test if that helps.

Copy link
Member

@rusackas rusackas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rusackas rusackas merged commit e7b965a into apache:master Jul 7, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2022

Ephemeral environment shutdown and build artifacts deleted.

akshatsri pushed a commit to charan1314/superset that referenced this pull request Jul 19, 2022
* fix bad date type in email text report for table chart

* fix test, pylint issue

* add test case for date type
sadpandajoe added a commit to preset-io/superset that referenced this pull request Jul 21, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels Preset-Patch size/M 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants