Skip to content

Commit

Permalink
m
Browse files Browse the repository at this point in the history
  • Loading branch information
mudroljub committed Dec 13, 2024
1 parent 2e31835 commit ee5945e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/services/QuoteService.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ const applyVote = async(quoteId, newVote) => {
const { numberOfVotes, rating } = quote
const newRating = (rating * numberOfVotes + newVote) / (numberOfVotes + 1)

const newQuote = await Quote.findOneAndUpdate(
const updatedQuote = await Quote.findOneAndUpdate(
{ _id: quoteId },
{ $set: { numberOfVotes: numberOfVotes + 1, rating: newRating } },
{ new: true }
)

return newQuote
return updatedQuote
}

export default {
Expand Down

0 comments on commit ee5945e

Please sign in to comment.