Merge pull request #47 from KevinMidboe/refactor/ballot-becomes-raffle

Renamed all references to ballot to raffle.
This commit is contained in:
2020-10-11 18:23:41 +02:00
committed by GitHub
6 changed files with 19 additions and 19 deletions

View File

@@ -45,7 +45,7 @@ const attendees = async (req, res) => {
attendee = attendees[i];
attendeesRedacted.push({
name: attendee.name,
ballots: attendee.red + attendee.blue + attendee.yellow + attendee.green,
raffles: attendee.red + attendee.blue + attendee.yellow + attendee.green,
red: attendee.red,
blue: attendee.blue,
green: attendee.green,
@@ -99,27 +99,27 @@ const drawWinner = async (req, res) => {
message: "No attendees left that have not won."
});
}
let ballotColors = [];
let raffleColors = [];
for (let i = 0; i < allContestants.length; i++) {
let currentContestant = allContestants[i];
for (let blue = 0; blue < currentContestant.blue; blue++) {
ballotColors.push("blue");
raffleColors.push("blue");
}
for (let red = 0; red < currentContestant.red; red++) {
ballotColors.push("red");
raffleColors.push("red");
}
for (let green = 0; green < currentContestant.green; green++) {
ballotColors.push("green");
raffleColors.push("green");
}
for (let yellow = 0; yellow < currentContestant.yellow; yellow++) {
ballotColors.push("yellow");
raffleColors.push("yellow");
}
}
ballotColors = shuffle(ballotColors);
raffleColors = shuffle(raffleColors);
let colorToChooseFrom =
ballotColors[Math.floor(Math.random() * ballotColors.length)];
raffleColors[Math.floor(Math.random() * raffleColors.length)];
let findObject = { winner: false };
findObject[colorToChooseFrom] = { $gt: 0 };

View File

@@ -5,9 +5,9 @@
Velg hvilke farger du vil ha, fyll inn antall lodd og klikk 'generer'
</p>
<RaffleGenerator @numberOfBallots="val => this.numberOfBallots = val" />
<RaffleGenerator @numberOfRaffles="val => this.numberOfRaffles = val" />
<Vipps class="vipps" :amount="numberOfBallots" />
<Vipps class="vipps" :amount="numberOfRaffles" />
<Countdown :hardEnable="hardStart" @countdown="changeEnabled" />
</div>
</template>
@@ -27,7 +27,7 @@ export default {
data() {
return {
hardStart: false,
numberOfBallots: null
numberOfRaffles: null
};
},
mounted() {

View File

@@ -4,10 +4,10 @@
<div class="attendees-container" ref="attendees">
<div class="attendee" v-for="(attendee, index) in flipList(attendees)" :key="index">
<span class="attendee-name">{{ attendee.name }}</span>
<div class="red-raffle ballot-element small">{{ attendee.red }}</div>
<div class="blue-raffle ballot-element small">{{ attendee.blue }}</div>
<div class="green-raffle ballot-element small">{{ attendee.green }}</div>
<div class="yellow-raffle ballot-element small">{{ attendee.yellow }}</div>
<div class="red-raffle raffle-element small">{{ attendee.red }}</div>
<div class="blue-raffle raffle-element small">{{ attendee.blue }}</div>
<div class="green-raffle raffle-element small">{{ attendee.green }}</div>
<div class="yellow-raffle raffle-element small">{{ attendee.yellow }}</div>
</div>
</div>
</div>

View File

@@ -8,7 +8,7 @@
color.name +
'-container ' +
color.name +
'-raffle inner-bought-container ballot-element'
'-raffle inner-bought-container raffle-element'
"
:key="color.name"
>

View File

@@ -4,7 +4,7 @@
<h2>TREKKER</h2>
<div
:class="currentColor + '-raffle'"
class="ballot-element center-new-winner"
class="raffle-element center-new-winner"
:style="{ transform: 'rotate(' + getRotation() + 'deg)' }"
>
<span v-if="currentName && colorDone">{{ currentName }}</span>
@@ -20,7 +20,7 @@
<h2>VINNER</h2>
<div
:class="currentColor + '-raffle'"
class="ballot-element center-new-winner"
class="raffle-element center-new-winner"
:style="{ transform: 'rotate(' + getRotation() + 'deg)' }"
>
<span v-if="currentName && colorDone">{{ currentName }}</span>

View File

@@ -4,7 +4,7 @@
<div class="winners" v-if="winners.length > 0">
<div v-for="(winner, index) in winners" :key="index">
<router-link :to="`/highscore/${ encodeURIComponent(winner.name) }`">
<div :class="winner.color + '-ballot'" class="ballot-element">{{ winner.name }}</div>
<div :class="winner.color + '-raffle'" class="raffle-element">{{ winner.name }}</div>
</router-link>
</div>
</div>