Function: rate()
function rate(
context,
siteUrl,
item,
rating
): Promise<{
aggregate?: string;
changed: string;
count?: number;
}>;
Defined in: areas/ratings/ratings.ts:52
Rates a forum post, a glossary entry or a database record as the person, as the rating menu under
it does: by a scale item's name, or its number (the points of a point scale). null takes the
person's rating away. Returns a sentence of what changed and the item's aggregate afterwards (as
Moodle shows it, by the activity's aggregation) with the number of ratings. Throws GradingError
when the item has no rating menu for the person (ratings off, their own item, outside the
rating period, or no permission) or the rating isn't on its scale.
Parameters
| Parameter | Type |
|---|---|
context | BrowserContext |
siteUrl | string |
item | RateableItem |
rating | string | number | null |
Returns
Promise<{
aggregate?: string;
changed: string;
count?: number;
}>