Just to keep my editor happy.
@author: Avram Gottschlich
"""
"""
@author: Avram Gottschlich
"""
"""
-I copied several functions from your code;
+I copied several functions from your code;
if it's easier to refer to them rather than copying them that's absolutely fine
This rewrites the html each time it is called
if it's easier to refer to them rather than copying them that's absolutely fine
This rewrites the html each time it is called
def hunt_info(turb, hunt):
"""
def hunt_info(turb, hunt):
"""
- Retrieves list of rounds, puzzles for the given hunt
+ Retrieves list of rounds, puzzles for the given hunt
"""
name = hunt["name"]
hunt_id = hunt["hunt_id"]
channel_id = hunt["channel_id"]
"""
name = hunt["name"]
hunt_id = hunt["hunt_id"]
channel_id = hunt["channel_id"]
puzzles = hunt_puzzles_for_hunt_id(turb, hunt_id)
puzzles = hunt_puzzles_for_hunt_id(turb, hunt_id)
rounds = set()
for puzzle in puzzles:
if "rounds" not in puzzle:
rounds = set()
for puzzle in puzzles:
if "rounds" not in puzzle:
rounds.add(rnd)
rounds = list(rounds)
rounds.sort()
rounds.add(rnd)
rounds = list(rounds)
rounds.sort()
return puzzles, rounds
def round_stat(rnd, puzzles):
return puzzles, rounds
def round_stat(rnd, puzzles):
meta_solved = 0
for puzzle in puzzles:
if "rounds" not in puzzle:
meta_solved = 0
for puzzle in puzzles:
if "rounds" not in puzzle:
if rnd in puzzle["rounds"]:
if puzzle['type'] == 'meta':
metas.append(puzzle)
if rnd in puzzle["rounds"]:
if puzzle['type'] == 'meta':
metas.append(puzzle)
unsolved_puzzles = sorted(unsolved_puzzles, key = lambda i: i['name'])
rnd_puzzles = metas + unsolved_puzzles + solved_puzzles
return puzzle_count, solved_count, rnd_puzzles, meta_solved, len(metas)
unsolved_puzzles = sorted(unsolved_puzzles, key = lambda i: i['name'])
rnd_puzzles = metas + unsolved_puzzles + solved_puzzles
return puzzle_count, solved_count, rnd_puzzles, meta_solved, len(metas)
def overview(puzzles, rounds):
#big board, main page. saves as index.html
start = ['<!DOCTYPE html>\n',
def overview(puzzles, rounds):
#big board, main page. saves as index.html
start = ['<!DOCTYPE html>\n',
' <p>Puzzles: {}/{}</p>\n'.format(solved_count, puzzle_count),
' <p>Metas: {}/{}</p>\n'.format(meta_solved, metas),
' </div>\n']
' <p>Puzzles: {}/{}</p>\n'.format(solved_count, puzzle_count),
' <p>Metas: {}/{}</p>\n'.format(meta_solved, metas),
' </div>\n']
expanding += [
' <div id="b{}" class="containerTab {}" style="display:none;">\n'.format(i, status),
' <span onclick="this.parentElement.style.display=\'none\'" class="closebtn">x</span>\n',
expanding += [
' <div id="b{}" class="containerTab {}" style="display:none;">\n'.format(i, status),
' <span onclick="this.parentElement.style.display=\'none\'" class="closebtn">x</span>\n',
else:
meta = ''
slack_url = channel_url(puzzle['channel_id'])
else:
meta = ''
slack_url = channel_url(puzzle['channel_id'])
if puzzle['status'] == 'solved':
puzzle_list += [ ' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
if puzzle['status'] == 'solved':
puzzle_list += [ ' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
slack_url = channel_url(puzzle['channel_id'])
round_url = link(website + "_".join(rnd.split()) + "_round.html", puzzle['rounds'][0])
#assuming one round per puzzle for now
slack_url = channel_url(puzzle['channel_id'])
round_url = link(website + "_".join(rnd.split()) + "_round.html", puzzle['rounds'][0])
#assuming one round per puzzle for now
solved_code += [' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
' <td>{}</td>\n'.format(elink(puzzle['url'], 'Puzzle')),
solved_code += [' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
' <td>{}</td>\n'.format(elink(puzzle['url'], 'Puzzle')),
slack_url = channel_url(puzzle['channel_id'])
round_url = link(website + "_".join(rnd.split()) + "_round.html", puzzle['rounds'][0])
#assuming one round per puzzle for now
slack_url = channel_url(puzzle['channel_id'])
round_url = link(website + "_".join(rnd.split()) + "_round.html", puzzle['rounds'][0])
#assuming one round per puzzle for now
unsolved_code += [' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
' <td>{}</td>\n'.format(elink(puzzle['url'], 'Puzzle')),
unsolved_code += [' <tr>\n',
' <td>{}</td>\n'.format(elink(slack_url, puzzle['name']+meta)),
' <td>{}</td>\n'.format(elink(puzzle['url'], 'Puzzle')),