lifterlms
lifterlms copied to clipboard
Added support for all Post Statuses for sales reporting.
Description
The user was not able to filter sales reporting for a course with Private | Draft | Pending post statuses. This PR fixes the issue.
Fixes #2490
How has this been tested?
Manually.
Types of changes
Bug fix
Checklist:
- [x] This PR requires and contains at least one changelog file.
- [x] My code has been tested.
- [x] My code passes all existing automated tests.
- [x] My code follows the LifterLMS Coding & Documentation Standards.
done escaping.
Looks good, can you just escaping more stuff? This only to improve our past code you know... :D Thanks <3
it's done 👌
@actuallyakash bump
Hey @actuallyakash this is good - except for coding standards issues to fix. Also, have you checked for all the possible post statuses then, even for scheduled posts?
Hey @eri-trabiccolo
by "scheduled posts" did you mean "pending posts"?
Hey @actuallyakash this is good - except for coding standards issues to fix. Also, have you checked for all the possible post statuses then, even for scheduled posts?
Hey @eri-trabiccolo
by "scheduled posts" did you mean "pending posts"?
hey @actuallyakash
I mean when you schedule a post to be published in the future:
@eri-trabiccolo
sorry for the late response.
I mean when you schedule a post to be published in the future:
No, the scheduled posts (courses/memberships) are not visible. We're currently using get_post_statuses() which only returns draft,pending,private,publish. Though, we can add a future tag by appending it to the array.
Should we show scheduled posts as old posts can be again rescheduled? Let me know your thoughts.
@actuallyakash What I think we should do is to allow users to filter by all the (existing) courses/memberships that produced a sale that is visible in the graph/numbers. So check this: buy a course, turn its status to "whatever status" (except for trash/deleted), if the sale appears in that reporting screen (its amount is counted, the graphs shows it) etc, then we should be able to filter by that course too.
@actuallyakash let's not forget about this :D
@actuallyakash let's not forget about this :D
Didn't forget :D
I worked on it in between the tasks and still working on finding the solution. Will wrap it up soon.
hey @eri-trabiccolo
I've added future post-status to data-post-statuses for showing scheduled posts (courses/memberships).
I don't think showing the sold posts is feasible at the moment as we are passing the courses and memberships post type here. We need to fetch the orders and then fetch the courses associated with them. Too long a process. Perhaps, there must be a shorter one which I'm not able to find without changing the logic in this query.
I think for now, adding future will be sufficient. Let me know your thoughts. 😁
Did we accidentally undo the change to include private posts in the second commit here: https://github.com/gocodebox/lifterlms/pull/2493/commits/c4778166d67429cd921806f987a9fd1f5af62514#diff-62976cfc458475b0fd1f70759a37960b64b21da658718ede3884e3897062b4a6L62
Let's double check that. Test. Review and merge.
Private posts were being included by default as part of the PR, but reverted. No changes to what it was before in that file.