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

Remove limit from fetching data for data export #7647

Merged
merged 3 commits into from
Jul 31, 2024

Conversation

merkushin
Copy link
Member

Resolves #7629

When we export student progress by a course, when the course has many lessons (more than 10), we miss part of the progress in exported data.
That happens because of the default limit (normally, 10) for the query that fetches data.

Proposed Changes

  • Remove the limit from fetching data for data export.

Testing Instructions

  1. Create a course with at least 10 lessons. (Simplest thing would be to import and publish the demo course.)
  2. As a student, start taking the course.
  3. Browse to wp-admin/admin.php?page=sensei_reports&user_id=<user_id>&course_id=<course_id> for the given user and course ID.
  4. Export all rows.
  5. Make sure CSV contains data for all lessons you took as the student.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@merkushin merkushin added this to the 4.24.2 milestone Jul 30, 2024
@merkushin merkushin requested a review from a team July 30, 2024 00:15
@merkushin merkushin self-assigned this Jul 30, 2024
@@ -328,7 +328,7 @@ public function generate_report( $report ) {
$this->search = $search;

$args = array(
'number' => '',
'number' => -1,
Copy link
Member Author

@merkushin merkushin Jul 30, 2024

Choose a reason for hiding this comment

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

@donnapep
Here, I removed the limit completely to allow export all existing data (even if there are 100000 rows). This is how I get “Export all rows”.
On the other hand, we can read “Export all rows” as “Export all visible rows”. In this case, we need to apply the same limit we use on the page.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link
Member

@m1r0 m1r0 left a comment

Choose a reason for hiding this comment

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

LGTM!

I'm not concerned that the server will be running out of memory because of too many lessons. It seems unlikely and should be considered as an edge case.

@merkushin merkushin merged commit dfc51fa into trunk Jul 31, 2024
23 checks passed
@merkushin merkushin deleted the fix/report-export-limit branch July 31, 2024 04:59
donnapep added a commit that referenced this pull request Aug 20, 2024
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.

Exporting lessons by student only exports some lessons
2 participants