Reference problem

I want to put a ‘Ratings’ in the ‘Product Page’, but it is showing the same Rating for all the products.
Can anyone help me in fixing this issue.
Thank you .

I tried the followings -

CODE -

import wixData from 'wix-data';
import wixWindow from 'wix-window';

export function ratingsInput1_change_1(event) {
   $w("#dataset1").onReady(() => {
 // get the current item from the dataset
 const currentItem = $w("#dataset1").getCurrentItem();
 // const product = $w('#productPage1').getProduct(); 

 // 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.totalRatings1;

 // 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);
 
 // const productName = product.name;

 // set the dataset fields to the new average, total
 // ratings, and number of ratings
  $w('#dataset2').setFieldValues({
 'avg': newAverageShort,
 'totalRatings1': total + newRating,
 'numRatings': (count + 1)
  });
 
 // save the dataset fields to the collection
  $w('#dataset2').save()
   .catch((err) => {
    console.log('could not save new rating');
   });
 });
 }


RESULT -