Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-19212

recomputeAverageRating cannot recompute a like count to 0

    XMLWordPrintable

    Details

    • Tests:
      Unit
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      If you call recomputeAverageRating on a document that has no likes you get the following exception:

      2021-12-08 16:39:11,256 [http-nio-8080-exec-1 - http://<>.devxwiki.com/xwiki/bin/view/XWiki/<>/Code/RecomputeLikeCount?confirm=1&all=1] ERROR o.h.e.j.s.SqlExceptionHelper - (conn=407380) Unknown column 'NaN' in 'field list'
      org.xwiki.ratings.RatingsException: Error while saving Average Rating [identifier = [devportal:GitLab.like-enterprise_-1934381928], managerId = [like], reference = [devportal:GitLab.like-enterprise], averageVote = [NaN], totalVote = [0], scale = [1], updatedAt = [Wed Dec 08 16:39:11 CET 2021]].
      at org.xwiki.ratings.internal.averagerating.XObjectAverageRatingManager.saveAverageRating(XObjectAverageRatingManager.java:315)
      at org.xwiki.ratings.internal.averagerating.AbstractAverageRatingManager.updateAverageRating(AbstractAverageRatingManager.java:90)
      at org.xwiki.ratings.internal.averagerating.AbstractAverageRatingManager.resetAverageRating(AbstractAverageRatingManager.java:145)
      at org.xwiki.ratings.internal.SolrRatingsManager.recomputeAverageRating(SolrRatingsManager.java:558)
      at org.xwiki.ratings.RatingsManager$recomputeAverageRating.call(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
      at Script11.run(Script11.groovy:29)

      The value being NaN it cannot be stored. It would be expected that the AverageRatingsClass object is removed or at least the value set to 0 if there is an existing count.

        Attachments

          Activity

            People

            Assignee:
            surli Simon Urli
            Reporter:
            ludovic Ludovic Dubost
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: