roadmap icon indicating copy to clipboard operation
roadmap copied to clipboard

Usage dashboard - bar chart click function broken

Open gjacob24 opened this issue 1 year ago • 1 comments

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 avatar Jul 31 '24 14:07 gjacob24

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.

gjacob24 avatar Jul 31 '24 15:07 gjacob24