Skip to content

Conversation

@rawdreeg
Copy link

@rawdreeg rawdreeg commented Mar 19, 2025

All Submissions:

Changes proposed in this Pull Request:

While generating some orders to test some reports, I realised that all orders generated via the UI have the same date. @garymurray has brought this up before, so I decided to implement it

This PR adds dates fields to the form and provides start-date and end-date args to the generate orders and generate products jobs.

How to test the changes in this Pull Request:

image

  1. Using a build from this branch
  2. Navigate to WP admin -> Tools -> Smooth Generator. Notice the new date input in the generate orders form.
  3. Confirm that this new parameter works by generating a few orders with a start date different from the current date. This should generate orders with various date between your selected start date and the current date.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Changelog entry

Add - Add start date to admin UI for generating orders.

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@rawdreeg rawdreeg self-assigned this Mar 19, 2025
@budzanowski
Copy link
Contributor

What happens to products? Will they be generated on the same date? I am just think that products can be created after orders that are using them.

@mikkamp
Copy link
Contributor

mikkamp commented Mar 19, 2025

Just a fly by comment.

According to the docs for the CLI commands:

Generate orders with random dates between --date-start and the current date.
wp wc generate orders <nr of orders> --date-start=2018-04-01

Whereas from the UI it looks like we will be generating orders on a specific day. Should the date-end also be possible?

@rawdreeg
Copy link
Author

What happens to products? Will they be generated on the same date? I just think that products can be created after orders that are using them.

Thanks @budzanowski. That's correct. However, it is also possible to generate orders without products. So we haven't been enforcing accuracy on these scenarios, lol. Applying the date range argument to both products and orders should help here.

@rawdreeg
Copy link
Author

Thanks @mikkamp,

Whereas from the UI it looks like we will be generating orders on a specific day. Should the date-end also be possible?

I think if you don't specify a date-end, the current date is assumed to be the end date. But I agree we can add it as an option.

@mikkamp
Copy link
Contributor

mikkamp commented Mar 19, 2025

I think if you don't specify a date-end, the current date is assumed to be the end date. But I agree we can add it as an option.

Yes it will use the current date. I mainly meant to imply that the UI just has a single date picker, it doesn't specify what that date signifies, so my visual interpretation would be that it would generate 10 orders for the date that I select. But instead it uses random dates for a date range where I was able to select the start date. So even just a small blurb of text explaining what the date does is enough.

@rawdreeg rawdreeg changed the title Add start date argument to admin UI for generating orders. Add date range arguments to admin UI for generating data. Mar 19, 2025
@rawdreeg
Copy link
Author

rawdreeg commented Mar 19, 2025

@budzanowski

I reworked the PR to apply the date argument to products as well.

Screen Recording 2025-03-19 at 14 09 40

Yes it will use the current date. I mainly meant to imply that the UI just has a single date picker, it doesn't specify what that date signifies

@mikkamp, that makes sense. I added the end-date option too.

I wonder whether I should put the date options before the "generate" fields on the form.

@budzanowski
Copy link
Contributor

I wonder whether I should put the date options before the "generate" fields on the form.

I don't think that it is necessary.

@rawdreeg rawdreeg merged commit 86a8ab4 into trunk Mar 20, 2025
@rawdreeg rawdreeg deleted the add/add-start-date-arg-generate-order-ui branch March 20, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants