-
Notifications
You must be signed in to change notification settings - Fork 1
/
2023-winter-major.R
211 lines (195 loc) · 6.32 KB
/
2023-winter-major.R
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
source("src/print-post.R")
source("src/update-google-sheet.R")
source("src/update-website-data.R")
library(tidyverse)
league_ids <- list("Winter Major 2023" = 15089)
period_dates <- list(
"period_1" = list(
"start_time" = as.POSIXct("2023-02-22 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-02-23 08:00", tz = "UTC") %>% as.integer()
),
"period_2" = list(
"start_time" = as.POSIXct("2023-02-23 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-02-24 08:00", tz = "UTC") %>% as.integer()
),
"period_3" = list(
"start_time" = as.POSIXct("2023-02-24 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-02-25 08:00", tz = "UTC") %>% as.integer()
),
"period_4" = list(
"start_time" = as.POSIXct("2023-02-25 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-02-26 08:00", tz = "UTC") %>% as.integer()
),
"period_5" = list(
"start_time" = as.POSIXct("2023-02-26 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-02-28 08:00", tz = "UTC") %>% as.integer()
),
"period_6" = list(
"start_time" = as.POSIXct("2023-02-28 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-01 08:00", tz = "UTC") %>% as.integer()
),
"period_7" = list(
"start_time" = as.POSIXct("2023-03-01 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-02 08:00", tz = "UTC") %>% as.integer()
),
"period_8" = list(
"start_time" = as.POSIXct("2023-03-02 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-03 08:00", tz = "UTC") %>% as.integer()
),
"period_9" = list(
"start_time" = as.POSIXct("2023-03-03 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-04 08:00", tz = "UTC") %>% as.integer()
),
"period_10" = list(
"start_time" = as.POSIXct("2023-03-04 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-05 08:00", tz = "UTC") %>% as.integer()
),
"period_11" = list(
"start_time" = as.POSIXct("2023-03-05 08:00", tz = "UTC") %>% as.integer(),
"end_time" = as.POSIXct("2023-03-06 08:00", tz = "UTC") %>% as.integer()
)
)
# Update Google Sheet
lapply(names(league_ids), function(league_name) {
update_google_sheet(
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
work_sheet = league_name,
league_id = league_ids[[league_name]],
exponential = TRUE,
update = FALSE
)
})
# Update website
lapply(names(league_ids), function(league_name) {
update_website_data(
league_id = league_ids[[league_name]],
period_dates = period_dates,
update = FALSE
)
})
# Create Reddit post
## Period 1
print_post(
league_ids = league_ids,
start_time = period_dates$period_1$start_time,
end_time = period_dates$period_1$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p1.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 2
print_post(
league_ids = league_ids,
start_time = period_dates$period_2$start_time,
end_time = period_dates$period_2$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p2.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 3
print_post(
league_ids = league_ids,
start_time = period_dates$period_3$start_time,
end_time = period_dates$period_3$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p3.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 4
print_post(
league_ids = league_ids,
start_time = period_dates$period_4$start_time,
end_time = period_dates$period_4$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p4.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 5
print_post(
league_ids = league_ids,
start_time = period_dates$period_5$start_time,
end_time = period_dates$period_5$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p5.txt",
innate_data_only = FALSE,
exponential = TRUE,
tiebreaker = TRUE,
tiebreaker_ranks = c(4, 6),
tie_best_of = 1,
tie_2_best_of = 3,
update = FALSE
)
## Period 6
print_post(
league_ids = league_ids,
start_time = period_dates$period_6$start_time,
end_time = period_dates$period_6$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p6.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 7
print_post(
league_ids = league_ids,
start_time = period_dates$period_7$start_time,
end_time = period_dates$period_7$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p7.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 8
print_post(
league_ids = league_ids,
start_time = period_dates$period_8$start_time,
end_time = period_dates$period_8$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p8.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 9
print_post(
league_ids = league_ids,
start_time = period_dates$period_9$start_time,
end_time = period_dates$period_9$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p9.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 10
print_post(
league_ids = league_ids,
start_time = period_dates$period_10$start_time,
end_time = period_dates$period_10$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p10.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)
## Period 11
print_post(
league_ids = league_ids,
start_time = period_dates$period_11$start_time,
end_time = period_dates$period_11$end_time,
google_sheet = "11ExiDnIYbupgsjuSbr9zeaBTXb_xn2N9uyvyD0Gz1bc",
file_path = "data/posts/2023_winter_major_p11.txt",
innate_data_only = FALSE,
exponential = TRUE,
update = FALSE
)