-
Notifications
You must be signed in to change notification settings - Fork 6
/
app.rb
66 lines (50 loc) · 1.63 KB
/
app.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
require 'sinatra'
require 'csv'
# require './helper_functions'
get '/' do
erb :index
end
post '/' do
@event = params[:event]
@swimmer = params[:swimmer]
@cyclist = params[:cyclist]
@runner = params[:runner]
if @event == 'men_march' || @event == 'men_april'
@event_name = "Men's Monthly Triathlon"
else
@event_name = "Ladies' Monthly Triathlon"
end
if @event == 'men_march' || @event == 'ladies_march'
@event_date = '15/3/2014'
else
@event_date = '15/4/2014'
end
@swimmer_first_name = @swimmer[:name].split.first
@swimmer_last_name = @swimmer[:name].split.last
@swimmer_dob = @swimmer[:dob]
@cyclist_first_name = @cyclist[:name].split.first
@cyclist_last_name = @cyclist[:name].split.last
@cyclist_dob = @cyclist[:dob]
@runner_first_name = @runner[:name].split.first
@runner_last_name = @runner[:name].split.last
@runner_dob = @runner[:dob]
erb :tickets
end
# post '/' do
# @event = params[:event]
# @swimmer = params[:swimmer]
# @cyclist = params[:cyclist]
# @runner = params[:runner]
# @event_name = event_name(@event)
# @event_date = event_date(@event)
# @swimmer_first_name = first_name(@swimmer[:name])
# @swimmer_last_name = last_name(@swimmer[:name])
# @swimmer_dob = @swimmer[:dob]
# @cyclist_first_name = first_name(@cyclist[:name])
# @cyclist_last_name = last_name(@cyclist[:name])
# @cyclist_dob = @cyclist[:dob]
# @runner_first_name = first_name(@runner[:name])
# @runner_last_name = last_name(@runner[:name])
# @runner_dob = @runner[:dob]
# erb :tickets
# end