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

Initial download of delivery report has invalid date in the filename #1113

Closed
miazima opened this issue Apr 5, 2021 · 0 comments · Fixed by #1116
Closed

Initial download of delivery report has invalid date in the filename #1113

miazima opened this issue Apr 5, 2021 · 0 comments · Fixed by #1116
Assignees
Labels
bug Something isn't working

Comments

@miazima
Copy link
Contributor

miazima commented Apr 5, 2021

Describe the bug
When downloading the initial delivery report after sending a campaign, without navigating away from the campaign sending page, the download filename has invalid date in the filename.

I could not replicate the issue after refreshing the page, so all further report downloads have the expected filename.

To Reproduce
Steps to reproduce the behavior:

  1. Create a SMS campaign and send out the campaign
  2. Do not navigate away from the campaign sending page and wait for the delivery report to be ready
  3. Click on 'Report' to download the file
  4. Observe the filename in the download window

Expected behavior
There should be a valid date in the report filename.

Screenshots
image

@miazima miazima added the bug Something isn't working label Apr 5, 2021
@zwliew zwliew self-assigned this Apr 6, 2021
zwliew added a commit that referenced this issue Apr 6, 2021
When sending a campaign for the first time, the `sentAt` field for the
in-memory representation of `Campaign` is still undefined. This causes
"invalid_Date" to appear in the filename of delivery reports.

Fix this by updating the `sentAt` field of the in-memory `Campaign` to
the current date when sending the campaign for the first time.

Fixes issue #1113
lamkeewei pushed a commit that referenced this issue Apr 14, 2021
* fix(campaign): correct Date types to string

Even though sent_at, created_at, and status_updated_at are represented
as Dates in the backend, these fields will be serialized to an ISO
string which the frontend then receives.

Hence, correct the type definition of these fields.

* refactor(dashboard): refactor onModalConfirm to a util function

* fix(dashboard): update local sentAt when sending campaign

When sending a campaign for the first time, the `sentAt` field for the
in-memory representation of `Campaign` is still undefined. This causes
"invalid_Date" to appear in the filename of delivery reports.

Fix this by updating the `sentAt` field of the in-memory `Campaign` to
the current date when sending the campaign for the first time.

Fixes issue #1113

* fix(campaign): mark sentAt and statusUpdatedAt as possibly undefined

* chore: refactor campaign stats polling to a custom hook

Note: make `refreshCampaignStats` a memoized callback to satisfy the
useEffect dependencies.

* Revert "fix(dashboard): update local sentAt when sending campaign"

Instead, we'll get the actual sentAt from the source.

This reverts commit 2abf7b3.

* fix: fall back to the current date if sentAt is undefined

* fix: fetch finalized campaign details after campaign is sent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants