DMPRoadmap / roadmap

DCC/UC3 collaboration for a data management planning tool
MIT License
106 stars 109 forks source link

Usage dashboard - bar chart click function broken #3443

Open gjacob24 opened 3 months ago

gjacob24 commented 3 months ago

Please complete the following fields as applicable:

What version of the DMPRoadmap code are you running? (e.g. v2.2.0) v4.1.1

Expected behaviour: If a user clicks on one of the bars in the chart graph representing 'No. of users joined during last year' or 'No. plans during last year', it should take them to the list of users/plans created in that month

Actual behaviour: The following error is thrown when you click on a bar in the abovementioned charts: Uncaught TypeError: chart.getElementAtEvent is not a function

Steps to reproduce: Note: this requires admin permissions Admin menu > Usage Click on 'Statistics on your Users' Click on a bar in the chart titled 'No. of users joined during last year' or 'No. of plans during last year'

gjacob24 commented 3 months ago

This issue was reported by one of the DMPonline users. I have created a PR with a fix (https://github.com/DMPRoadmap/roadmap/pull/3444).

Problem and proposed solution - after chart.js was upgraded to version 3, the function getElementAtEvent was replaced by getElementsAtEventForMode but this change was not reflected in the code. Once this change is made in app/javascript/src/usage/index.js, it works as expected.

Note: do not test this with super admin permissions because it does not filter the plans properly because the org is not passed in the query. Test only with admin account.