407408409410411412413414415416417
} rate.rating = ratingForm.rating; module.rating.add(rate); module.rating.calculateAverage(); module.save(); user.save(); } RatingResponseForm responseForm = new RatingResponseForm(); responseForm.totalRatings = module.rating.totalRatings();
8687888990919293949596
else { Module module = form.get(); module.owner = user; module.rating = new Rating(true); module.save(); createHistoricalEvent("New module - " + module.name, String.format("%s (%s) created a new module - %s", user.displayName, user.userName,
265266267268269270271272273274275
{ --module.downVoteCount; ++module.upVoteCount; vote.voteType = Vote.VoteType.UP; vote.save(); module.save(); } else { Logger.info(String.format("User [%s] tried to upvote module [%s] but vote already existed", user.userName,
285286287288289290291292293294295
vote.publicVote = false; user.votes.add(vote); user.save(); ++module.upVoteCount; module.save(); } VoteResponseForm responseForm = new VoteResponseForm(); responseForm.upVotes = module.upVoteCount; responseForm.downVotes = module.downVoteCount;
325326327328329330331332333334335
{ --module.upVoteCount; ++module.downVoteCount; vote.voteType = Vote.VoteType.DOWN; vote.save(); module.save(); } else { Logger.info(String.format("User [%s] tried to downvote module [%s] but vote already existed", user.userName,
345346347348349350351352353354355
vote.publicVote = false; user.votes.add(vote); user.save(); ++module.downVoteCount; module.save(); } VoteResponseForm responseForm = new VoteResponseForm(); responseForm.upVotes = module.upVoteCount; responseForm.downVotes = module.downVoteCount;