|
5 | 5 | package main
|
6 | 6 |
|
7 | 7 | import "fmt"
|
| 8 | +import "database/sql" |
8 | 9 |
|
9 | 10 | type CountryVotingData struct {
|
10 | 11 | worldwide int32
|
@@ -89,14 +90,7 @@ func prepare() int {
|
89 | 90 | var national int32
|
90 | 91 | var worldwide int32
|
91 | 92 |
|
92 |
| - /* |
93 |
| - you know as much as I dislike python and think Go is just plain better |
94 |
| - it is now also apparent that Go can also suck a cactus with shit like this |
95 |
| - file type is an int? |
96 |
| - national is an int? |
97 |
| - IS ANYTHING NOT AN INT? |
98 |
| - THE INTS ARE TAKING OVER |
99 |
| - */ |
| 93 | + // does this even work? |
100 | 94 |
|
101 | 95 | fmt.Println("Preparing ...")
|
102 | 96 | if production { // todo: learn go
|
@@ -169,3 +163,53 @@ func automatic_questions() int {
|
169 | 163 | mysql_get_questions(1, nw) // todo: mysql in go
|
170 | 164 | questions = 1
|
171 | 165 | }
|
| 166 | + |
| 167 | +func automatic_results() int { |
| 168 | + var write_results int32 |
| 169 | + var results int32 |
| 170 | + var national int32 |
| 171 | + var worldwide int32 |
| 172 | + var questions int32 |
| 173 | + var national_results int32 |
| 174 | + var worldwide_results int32 |
| 175 | + var nw int32 |
| 176 | + |
| 177 | + // sigh |
| 178 | + |
| 179 | + |
| 180 | + write_results = true |
| 181 | + nw = os.Args[2:] |
| 182 | + if nw == "n": |
| 183 | + days = 7 |
| 184 | + else if nw == "w": |
| 185 | + days = 15 |
| 186 | + results[get_poll_id()] = mysql_get_votes(days, nw, 1) |
| 187 | + delete results[None] // except keyerror pass?? |
| 188 | + national = 0 |
| 189 | + worldwide = 0 |
| 190 | + questions = 0 |
| 191 | +} |
| 192 | + |
| 193 | +func automatic_votes() int { |
| 194 | + var write_questions int32 |
| 195 | + var write_results int32 |
| 196 | + var questions int32 |
| 197 | + var results int32 |
| 198 | + var national int32 |
| 199 | + var worldwide int32 |
| 200 | + var questions int32 |
| 201 | + |
| 202 | + write_questions = true |
| 203 | + write_results = true |
| 204 | + mysql_get_questions(1, "w") |
| 205 | + mysql_get_questions(3, "n") |
| 206 | + questions = national + worldwide |
| 207 | + question_count = len(question_data) |
| 208 | + printf("Loaded %s %s" % (question_count, "Questions")) |
| 209 | + for v in list(reversed(range(1, 7))) { |
| 210 | + results[get_poll_id()] = mysql_get_votes(7, "n", v) |
| 211 | + results[get_poll_id()] = mysql_get_votes(15, "w", 1) |
| 212 | + } // THIS DOESNT EVEN WORK because i don't know go |
| 213 | + delete results[None] |
| 214 | +} |
| 215 | + |
0 commit comments