[haiku-depot-web] Re: userRatingStabilityCode

  • From: Andrew Lindesay <apl@xxxxxxxxxxxxxx>
  • To: haiku-depot-web@xxxxxxxxxxxxx
  • Date: Mon, 29 Sep 2014 02:50:50 +1300

Hello Stephan;

what are the valid values for "userRatingStabilityCode" in the
CreateUserRatingRequest or UpdateUserRatingRequest?

Here are those codes;

       code        |        name
-------------------+---------------------
 nostart           | Will Not Start
 veryunstable      | Very Unstable
 unstablebutusable | Unstable but Usable
 mostlystable      | Mostly Stable
 stable            | Stable

When the user rates a package in HaikuDepot, my plan is to use the
SearchUserRatingsRequest to query for a previous rating of the current
user for the latest version of the package. If there is one, the rating
window would be prefilled with the rating's values, so the user can edit
it. The actions in the window would then be "Update rating" and "Delete
rating" (or more accurately "Hide rating" ?). If there is no previous
rating, the CreateUserRatingRequest would be used to create a new one. I
am hoping that the search request will not give me a rating when the
user has not made one for the current version of the package when I
request LATEST for version in the search. When using the
CreateUserRatingRequest, the package version would be specified to the
current package version. Sounds good?

The intention is exactly as you had assumed with one change; to find the existing user-rating, use the API method;

        UserRatingApi#getUserRatingByUserAndPkgVersion(..)

This method will return data for inactive user-ratings and will throw ObjectNotFoundException error in the case where there was no user-rating present. It will not return a result when there was none stored.

Either the update or create calls will end up triggering an asynchronous re-calculation of the aggregated user rating for the associated package. The algorithm for this is outlined in the documentation [1].

With regard to "Delete rating" versus "Hide rating"... does the
SearchUserRatingsRequest give me inactive ratings? If yes, that would
allow me to "unhide" a rating, so the action could be "Hide rating" and
not "Delete rating".

The method...

        UserRatingApi#searchUserRatings(..)

...will not return inactive user-ratings.

Wow; it sounds like you have made some really solid headway on the HaikuDepot application of late!

cheers.

[1]
http://www.silvereye.co.nz/tmp/haikudepotserver-docs-26sep2014-tmp.pdf

--
Andrew Lindesay

Other related posts: