Statistics report export XLSX not working

Statistics report export XLSX not working

by Helder Pereira -
Number of replies: 15

Hello, I'm trying to debug but I cannot go further with this, I have a problem where I have a quiz with almost 1700 answers. When I try to get the statistics to a file I can only catch this error in the logs:

Default exception handler: Exception - Call to a member function has_subparts() on bool

Debug: \nError code: generalexceptionmessage\n* line 79 of /mod/quiz/report/statistics/statistics_question_table.php:

Error thrown\n* line 421 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_question_table->question_setup()\n*

line 897 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->output_individual_question_response_analysis()\n*

line 197 of /mod/quiz/report/statistics/report.php: call to quiz_statistics_report->output_all_question_response_analysis()\n*

line 97 of /mod/quiz/report.php: call to quiz_statistics_report->display()\n,

referer: https://wb4pre.webbanca.pt/mod/quiz/report.php?id=10634&mode=statistics

Now the odd part, this happens to XLSX and ODS but not to CSV

To screen everything works, the statistics appear fine.

Any clue?

Thanks!

Average of ratings: -
In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Helder Pereira -
Nobody has this problem also?
In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
I can only speak for myself. No, I don't have this problem. But what is wrong with using the csv file? Excel can read csv?
In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -

Well, because CSV is not quite like XLST. If it's the same why Moodle has the 2 options?

In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
Yes, you are correct that csv is not xlsx. But I find that csv quiz data, when opened in Excel, is actually a bit cleaner than the xlsx file. And I can save the csv file as xlsx, if I prefer. I am not the programmer, but my guess is that the programmer has to make a few assumptions when creating the xlsx file, including which version of Excel to create. This decision is not needed for csv. It might be that to create the xlsx file, some temporary files must be created and the size of these temporary files exceeds your moodle's capabilities, such as max_filesize, or something like that? I am just thinking a bit out loud, trying to help you or others jump in with a technical explanation.

I just when into one of my quizzes and exported the stats to all three formats.  It worked.  But my quiz is much smaller.  Try a small quiz and see if it works.  Then you might begin to know if it has something to do with your big quiz.

When you look at the csv file in Excel, are you seeing anything strange when you open it?
In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -

Hi, thanks for your reply.

If the quiz is smaller everything works. That makes me think you may have a point in the max_filesize... although we already have a big value there. I will look in to it. But if that was the case, shouldn't the error be more obvious?

For me CSV is ok, but this is to other persons in my organization to work and they have preference for XLST...

I will try and post if max_filesize makes a change.

In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

It can also be a timeout issue.

From my own notes, for php.ini, I have:

upload_max_filesize  = 128M
post_max_size  = 128M
memory_limit = 384M (maybe set this to 512M) (might need >256 for “undefined” popup to disappear
max_input_time from 60 to 200 or 600 (try 1200 for restoring a course, if a problem)
max_execution_time from 30 to 900 (1200 needed for restoring courses) (300 is a good start)
Add max_input_vars = 5000; (Fixed problem with gradebook in 2.3.1+

I think that you mean XLSX, not XLST.  An XLST file is an Excel template file, something different than XLSX.

When I download a csv file and double-click on it, it opens in Excel by default.  This might be a good time to educate persons in your organization about csv files.

In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -
Yes, I meant XLSX, sorry.

And yes, I'm starting to ease them into CSV, although I continue to test some parameters.
In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -
Hi. I'm trying several changes to no effect on the problem. It cannot be memory, post size, or executions times, I have gigantic values there and it's the same result.
But I discovered one thing, at the end of all the data in the CSV I get a HTML page, the code itself, with error etc. Still trying to make something of that code, since it's very "messy".
Do you know what this would be?
In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
No, don't know why. You haven't said if the HTML is at the end of every record, or at the very end of the csv file?
In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -

It's at the end of the file only.

See for yourself if want of course.

I attach it.

I found the same error I described above, but some things do look like timeout, but it can't be the post_max_size, nor memory, because I have enormous values there. 4Gb post_max_size, 2Gb memory, 6000 on time...

A bit clueless here...

In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers
So, you say you export to csv, you get the csv data and this HTML at the end. If so, I don't know what else to tell you. Your problem seems to only exist for large quizzes.

Maybe someone else will have an idea.
In reply to Rick Jerz

Re: Statistics report export XLSX not working

by Helder Pereira -

Yes. Export to CSV works but at the end I get this HTML code.

HTML table also functions well.

Problem exists in XLSX and ODS.

Well, thank you for your help. I tried your suggestions.

In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Samuel Witzig -
We also have some issues with quiz statistics (trying to export to excel). Amr, who is working at the same institution as me, reported this at https://tracker.moodle.org/browse/MDL-71180 - does this look similar to your issue?
In reply to Samuel Witzig

Re: Statistics report export XLSX not working

by Helder Pereira -

Hello! Let me check that tracker.

In reply to Helder Pereira

Re: Statistics report export XLSX not working

by Helder Pereira -

I don't think it may be the some problem, because we do not have large answers. We typically have multiple choice questions. Although the size of the question could be a problem? I'll look into to it. Thanks !