Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addRating(lesson: string, rating: string) {
const path = 'ratings/' + lesson;
getRef(this.database.database, path).transaction(ratings => {
if (ratings == null) {
ratings = {
lesson: lesson
};
}
const count = ratings[rating] || 0;
ratings[rating] = count + 1;
return ratings;
});
}
}
addRating(lesson: string, rating: string) {
const path = 'ratings/' + lesson;
getRef(this.database.database, path).transaction(ratings => {
if (ratings == null) {
ratings = {
lesson: lesson
};
}
const count = ratings[rating] || 0;
ratings[rating] = count + 1;
return ratings;
});
}