-
Notifications
You must be signed in to change notification settings - Fork 0
/
conveyor-belt.rb
67 lines (55 loc) · 1.59 KB
/
conveyor-belt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require 'csv'
# CONFIG OPTIONS
FILE_PATH = 'submissions.csv'
PROJECT_DESCRIPTION_KEY = 'Tagline'
PROJECT_LOCATION_KEY = 'Team ID/Table No.'
HAMMER = true
# END CONFIG OPTIONS
submissions = CSV.parse(File.read(FILE_PATH), headers: true)
waves = 2
projects = []
judges = []
wave_assignments = {}
counter = 1
submissions.each do |submission|
unless wave_assignments.has_key?(submission['Team'])
wave_assignments[submission['Team']] = counter
counter = if counter != waves
counter + 1
else
1
end
if HAMMER
projects.push({
name: submission['Project Title'],
wave: wave_assignments[submission['Team']],
description: submission[PROJECT_DESCRIPTION_KEY],
location: submission[PROJECT_LOCATION_KEY]
})
else
projects.push({
name: submission['Project Title'],
description: submission[PROJECT_DESCRIPTION_KEY],
location: submission[PROJECT_LOCATION_KEY]
})
end
end
judges.push({
name: submission['Name'],
wave: wave_assignments[submission['Team']],
email: submission['Email'],
description: "Member of #{submission['Team']}."
})
end
if HAMMER
CSV.open('judges.csv', 'w') do |csv|
judges.each do |judge|
csv << judge.values
end
end
end
CSV.open('projects.csv', 'w') do |csv|
projects.each do |project|
csv << project.values
end
end