Exemple #1
0
 public function defaultVotesSet()
 {
     // check that the count of GroupVotes with this voting's id is equal to the count of all groups * number of voting items of this voting
     $groupCount = Group::all()->count();
     $votingItemCount = VotingItem::ofVoting($this->id)->count();
     $correctAmount = $groupCount * $votingItemCount;
     if (GroupVote::ofVoting($this->id)->count() == $correctAmount) {
         return true;
     }
     return false;
 }
 /**
  * Deletes a voting's default answers
  *
  * @param $id   The id of the voting to delete answers for
  */
 private function deleteGroupVotes($id)
 {
     $prevVotes = GroupVote::ofVoting($id)->get();
     foreach ($prevVotes as $gv) {
         $gv->delete();
     }
 }