Skip to content

Commit e716835

Browse files
committed
Update prizes for Paris 2022 event
1 parent e42aafc commit e716835

File tree

7 files changed

+546
-433
lines changed

7 files changed

+546
-433
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
- `SLACK_TOKEN` envvar: Slack token including at least `groups:read`, `users:read` and `users:read.email` permissions.
66
- `PORT` (optional, default: `3000`) envvar: HTTP port for the server to listen to
77
- `PRIZE_FILE` (optional, default: `./samples/prizes.json`) envvar: static JSON file for prize data
8-
- `ATTENDEE_CSV_FILE` envvar: static CSV file for alf.io attendee export
9-
8+
109
Note that the corresponding bot should be invited to private channels before the token can be used to retrieve those.
1110

1211
## Getting started

index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ const checkEnvVarPath = (path, envVar) => {
2323
}
2424

2525
const token = readEnvOrFail('SLACK_TOKEN');
26-
const attendeeCsvPath = readEnvOrFail('ATTENDEE_CSV_FILE');
27-
checkEnvVarPath(attendeeCsvPath, 'ATTENDEE_CSV_FILE');
2826
const port = process.env.PORT || 3000;
2927
const prizeFilePath = process.env.PRIZE_FILE || `${__dirname}/samples/prizes.json`;
3028
checkEnvVarPath(prizeFilePath, 'PRIZE_FILE');

lib/raffle-candidate-service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ module.exports = class RaffleCandidateService {
1414

1515
// TODO: make channel name configurable
1616
async _findOrgIds() {
17-
return this._slackChannelRepository.findOne('paris2021-org', true)
17+
return this._slackChannelRepository.findOne('paris2022-org', true)
1818
.then(channel => channel.id)
1919
.then(channelId => this._slackUserRepository.findAllMemberIds(channelId))
2020
}
2121

2222
// TODO: make channel name configurable
2323
async _findAllRaffleCandidateIds() {
24-
return this._slackChannelRepository.findOne('paris2021-raffle', false)
24+
return this._slackChannelRepository.findOne('paris2022-raffle', false)
2525
.then(channel => channel.id)
2626
.then(channelId => this._slackUserRepository.findAllMemberIds(channelId))
2727
}

lib/raffle-prize-repository.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = class RafflePrizeFileRepository {
55

66
constructor(prizeFile) {
77
const rawPrizes = fs.readFileSync(prizeFile);
8-
this._prizes = JSON.parse(rawPrizes.toString()).map((rawPrize) => new RafflePrize(rawPrize.description));
8+
this._prizes = JSON.parse(rawPrizes.toString()).map((rawPrize) => new RafflePrize(rawPrize.description)).sort(() => 0.5 - Math.random());
99
}
1010

1111
async getPrizes() {

0 commit comments

Comments
 (0)