Hello,
How do I stop writing my data to multiple lines?
I am trying to write review data to the database and it is not writing it to the current product instead it is adding two new lines in the collection one for Review Average and another for the How Many Reviews.
Here is my code;
let avgRating = (Math.round(stats.rating * 10 / stats.count) / 10);
// Compute the percentage of reviewers that recommend the product.
let percentRecommended = Math.round(stats.recommended / stats.count * 100);
// Get the ratings element.
let ratings = $w('#generalRatings');
let ratings2 = $w('#ratingsDisplay1');
// Set the ratings element's average rating to the value calculated above.
ratings.rating = avgRating;
ratings2.rating = avgRating;
wixData.insert("reviews", {"reviewAvg": avgRating});
// Set the ratings element's number of ratings to the count value from the statistics data.
ratings.numRatings = stats.count;
ratings2.numRatings = stats.count;
// Write review number to database
wixData.insert("reviews", {"numberofReviews": stats.count});
Here is my result;
How do I get this to be on the same line as the Product?
Thanks!