Report Generator not working in OJS 3.1.2

Hi,

the statistics report generator is not working in OJS 3.1.2: there are no entries in the csv file.

The error seems to be associated with the from-to-range. If only the current month is selected, the report is generated. If I select a range starting before 2020, the error occurs.

There’s one warning:

PHP Warning: count(): Parameter must be an array or an object that implements Countable in /data/ojs/…/lib/pkp/classes/statistics/PKPMetricsDAO.inc.php on line 149, referer: …/index.php/…/management/tools/reportGenerator

regards,
Carola

Hi @carola,

Which specific release of OJS 3.1.2 are you using?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I tested in on three installations:

3_1_2-4-1-g1726f5859d
3_1_2-3-4-g54bec18568
3_1_2-4-1-g1726f5859d

Hi @carola,

Which of the reports are you generating (PKP usage statistics report, view report, COUNTER, etc)?

Regards,
Alec Smecher
Public Knowledge Project Team

The report generator (management/tools/reportGenerator, where you can select the range day/month).

regards,
Carola

Hi @carola,

I think that’ll be the COUNTER plugin, but can you post the report URL (removing any identifying details if you like) so I can confirm what code is being called?

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

here is an example:

https://www…de/index.php/…/management/tools/generateReport?metricType=ojs%3A%3Acounter&columns[]=assoc_type&columns[]=month&filters=%7B%22assoc_type%22%3A%5B%22259%22%5D%2C%22context_id%22%3A%221%22%2C%22day%22%3A%7B%22from%22%3A%22202001%22%2C%22to%22%3A%22202002%22%7D%7D

regards,
Carola

Hi @carola,

Hmm, I’m having a hard time reproducing this locally; do you have pkp/pkp-lib#5302 Cast stdClass to array to avoid warnings · pkp/pkp-lib@8486017 · GitHub applied to your lib/pkp submodule?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

yes, I have this commit, but now I get the reports if I add

$values = (array)$values;

to PKPMetricsDAO.inc.php

$filters in an array, but $values is stdClass Object for day

regards,
Carola

filters: Array
(
[assoc_type] => Array
(
[0] => 259
)

[context_id] => 1
[day] => stdClass Object
    (
        [from] => 202001
        [to] => 202002
    )

[metric_type] => Array
    (
        [0] => ojs::counter
    )

)

Hi @carola,

Would it be possible for you to test whether you still get the error with the stable-3_1_2 branch?

Regards,
Alec Smecher
Public Knowledge Project Team

hi @asmecher,

the 3 installations I tested are all on stable-3_1_2 …

I can try other stable-3_1_2 installations next week to check if there are differences.

regards,
Carola

Hi @carola,

Are they all up-to-date pulls (for the ojs, pkp-lib, and usageStats repos)?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,

I upgraded 3_1_2-4-1-g1726f5859d to the lastest version yesterday (3_1_2-4-10-gb8054bc6d9) and now it works without the fix.

Thanks!
Carola