MDL-54968 user: change query for resetting dashboard
MDL-54968 user: change query for resetting dashboard

In case of inconsistent data the fatal error could have happen.
Also improve performance by joining several queries into one.

dilawar/moodle