Getting SDK error when ratings have reached to 5 instead of higher value

When the rating display has 6 or more stars instead of 5, I received an error message displayed in the Developer Console during preview of my webpage.

Error message:
“Wix code SDK error: The value of rating parameter that is passed to the rating method cannot be set to the value “9”. It must be between 1 and 5.”

My site’s editor link:

And here is the JavaScript code for estimating ratings:

export function ratingsInput1_change(event) {
$w("#dataset1").onReady(() => {
// get the current item from the dataset
const currentItem = $w("#dataset1").getCurrentItem();
// get the current average rating, number of ratings, and
//total ratings for the current dataset item
const average = currentItem.avg;
const count = currentItem.numRatings;
const total = currentItem.totalRatings;
// get the new rating from the ratings input
const newRating = $w('#ratingsInput1').value;
// calculate the new average rating based on the current
//average and count
const newAverageLong = (total + newRating) / (count +1);
// Round the average rating to 1 decimal point
const newAverageShort =                                             Number.parseFloat(newAverageLong).toFixed(1);
// set the dataset fields to the new average, total
// ratings, and number of ratings
$w('#dataset1').setFieldValues({
'avg': newAverageShort,
'totalRatings': total + newRating,
'numRatings': (count + 1)
});

// save the dataset fields to the collection
$w('#dataset1').save()
.catch((err) => {
console.log('could not save new rating');
});
});
}

Can anyone please solve and fix the 5-star rating problem? I cannot do this one.

I have checked your site and was unable to recreate the issue as you are describing it. However, I can see that your datasets were connected to your ratings elements incorrectly, which is causing them to throw errors. I recommend you to go through the tutorial once again and check if everything is set up correctly: https://support.wix.com/en/article/corvid-tutorial-capturing-and-displaying-ratings

Please observe the Community Guidelines - put your code in an code block, and format it nicely so that it can be easily read.