Podius::Property::Rating - component property useful for rating
Supposed to be used in the Podius::Component manpage and the Podius::Property manpage module trees only.
This property represent a simple polling where the participants with unique ids may rate something by giving a mark that is an integer value in certain interval. There are two main useful modes, when the interval is from 1 to some positive integer (5 by default), and when the interval is from -N to N (if -N is -1, then such poll correspond to just ``I like it, +1'' or ``I dislike it, -1''). The interval may be arbitrary actually, but these two main modes seems to be the most useful (the value 0 is a bit special in any mode and means no vote).
Some simple statistics may be queried, the number of votes, the sum of all marks, and the average (that is the ratio of the previous two integers, except when there are no votes, in which case it is 0).
The same participant can't vote several times, but may change their previous vote if needed.
the Podius::Property manpage, the Podius::Property::ScalarHash manpage.
Note, the validity of the value is verified and theoretically this method may delete the value if invalid, so you can't assume this method is read-only (use access for a read-only query).
* key to query
* value to verify
* key to apply * value to set * optional can_replace flag (default 0 means can't replace value)
* key to apply
* precision (0 - round to the nearest integer, N - round to N floating
points, "halfs" - means round to the nearest 0.5-times number)
This is a convenient way to get a ``stars'' representation of this property. It calls access_average('halfs'). i.e. a star type may be ``full'', ``half'' (half-full) or ``void'' (empty).
* optional parameter hash, the defaults are:
star_half => '<%=$CHAR_STAR_HALF%>'
star_full => '<%=$CHAR_STAR_FULL%>'
star_void => '<%=$CHAR_STAR_VOID%>'
delimeter => ' '