Article statistics column sorting

We had updated our platform (multijournal, multilang) to OJS 3.2.1-2 yesterday. No big problems, some small kinks to solve here or there.

Statistics filters now work on journals with main domains, and we and publishers are very happy with that.

There was a feedback by one publisher - it wishes that all columns in the article statistics are sortable, not only the Total column (see screenshot).

Would that be easy to implement? Thanky you for a pointer to the part of the code where I could start to modify by myself.


This would be a great contribution! Here’s a quick rundown of the steps that would be involved:

  1. Extend the GET /stats/publications endpoint of the REST API so that it accepts an orderBy parameter.
  2. Read our technical documentation to learn how our Reader Statistics Service works. In particular, read about how to get ordered objects (here’s the method in the code).
  3. You may be able to use the $groupBy argument in PKPStatsService::getOrderedObjects() to get what you want. However, it may be more complicated with individual file types, since you may need to group across multiple columns. It will probably be easier to group by abstracts/files than to group by individual file types.

Oh and I forgot the last step, which is the UI part. Read up on how to implement sorting in a Table component. The StatsPage.vue component should handle including the orderBy param with the API request. But if not, you can investigate the template and the page component.