Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b01927e
new prefest events
G-Aswin Jun 19, 2022
5784c19
event fix
G-Aswin Jun 19, 2022
2fa2f0e
upgraded mongo integration
Shrivastava-Aditya Jun 20, 2022
89e7e92
Merge pull request #8 from Shrivastava-Aditya/main
G-Aswin Jun 20, 2022
4ed9ad5
updated requirements
G-Aswin Jun 20, 2022
0ee2d9a
pymongo
G-Aswin Jun 20, 2022
ea83194
emergency fix
G-Aswin Jun 20, 2022
640db18
hogathon closed and new brochure liveC
G-Aswin Jun 21, 2022
342bc8e
updated brochure
Shrivastava-Aditya Jun 21, 2022
c8a86b1
Update prefest.html
Shrivastava-Aditya Jun 21, 2022
93b2d2d
fest registration excel and new brochure
G-Aswin Jun 21, 2022
f58abec
added timeline and shifted the brochure to the top
G-Aswin Jun 21, 2022
8f518b1
title change
G-Aswin Jun 21, 2022
3ada86d
dynamic events finally implemented
G-Aswin Jun 21, 2022
c95c67b
button cosmetics
G-Aswin Jun 21, 2022
b9b3a6c
responsiveness of tab2 fixed
kaushikp123 Jun 22, 2022
156d8d0
Delete venv directory
kaushikp123 Jun 22, 2022
8e9034f
Merge pull request #17 from kaushikp123/main
kaushikp123 Jun 22, 2022
b4b03b0
sorted events:
G-Aswin Jun 22, 2022
84ce877
Merge branch 'main' of https://github.com/G-Aswin/Parichay22
G-Aswin Jun 22, 2022
615bba6
added score page and admin
gs7vik Jun 22, 2022
597484f
event list updated
Shrivastava-Aditya Jun 22, 2022
e196035
updated department db
Shrivastava-Aditya Jun 22, 2022
48e9f7c
update on scoreboard
Shrivastava-Aditya Jun 22, 2022
8f5923d
master reg sheet added
G-Aswin Jun 22, 2022
143d580
updated scoreboard
Shrivastava-Aditya Jun 22, 2022
c1d7d13
updated scoreboard
Shrivastava-Aditya Jun 22, 2022
97d393e
updated route for scoreboard
Shrivastava-Aditya Jun 22, 2022
ad69557
final change
Shrivastava-Aditya Jun 22, 2022
dc38391
score and admin page
gs7vik Jun 23, 2022
f57f67d
Delete env directory
gs7vik Jun 23, 2022
dbca8cb
Merge pull request #22 from gs7vik/main
G-Aswin Jun 24, 2022
e3bd552
Scoreboard and admin
G-Aswin Jun 24, 2022
d6ed809
Merge pull request #20 from G-Aswin/score
G-Aswin Jun 24, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/db.cpython-310.pyc
Binary file modified __pycache__/app.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/app.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/db.cpython-310.pyc
Binary file not shown.
Binary file added __pycache__/db.cpython-39.pyc
Binary file not shown.
Binary file added __pycache__/scoreboard.cpython-310.pyc
Binary file not shown.
201 changes: 193 additions & 8 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,211 @@
from datetime import datetime
from flask import Flask, render_template, request, redirect, url_for, send_from_directory
import db
import scoreboard
from collections import defaultdict

# from db import day1events, day2events
from flask import g

app = Flask(__name__)

events = db.events
# events = db.events.sort({'event_id':1})
# g.events = events.find({})

@app.route('/')
def index():
print('Request for index page received')
# return render_template('index.html')
return redirect("/prefest")
return redirect("/events")

@app.route('/prefest')
def prefest():
return render_template('prefest.html')
print('Request for prefest page received')
return redirect("/events")

@app.route('/admin_control')
def admin_route():
print("reached admin")

return '<h1> Admin Page </h1>'

@app.route('/admin_control/score')
def score_updated():
print("reached score")
db.update_winner()
return '<h1> score updated </h1>'

@app.route("/scoreboard")
def scoreboard_display():
return '<h1> scoreboard </h1>'

@app.route("/refresh")
def refresh_scoreboard():
# file1 = open("winner.txt","r+")
# win_count = file1.read()
# if scoreboard.winner_count() > int(win_count):
# file1.write(scoreboard.winner_count())
# scoreboard.update_score()

return '<h1>updated scoreboard</h1>'

@app.route('/events')
def events():
return redirect("https://drive.google.com/file/d/1pe8VSO1KZaiY-mx959LKLnhtJULHw0sc/view")


events = db.events
department = db.department
winners = db.winners

event_list = events.find(
{},
{
"_id": 0,
"event_id": 1,
"event_name": 1,
"date": 1,
"time_begin": 1,
"time_end": 1,
"venue": 1,
"max_points": 1,
"google_form_link": 1,
"start_hour" : 1
},
)

day1events = []
day2events = []

day1 = datetime(2022, 5, 23, 18, 30)
day2 = datetime(2022, 5, 24, 18, 30)
for event in event_list:
if event["date"] == day1:
day1events.append(event)
else:
day2events.append(event)

day1events = sorted(day1events, key=lambda d: int(d['start_hour']))
day2events = sorted(day2events, key=lambda d: int(d['start_hour']))



return render_template('events.html', d1 = day1events, d2 = day2events)
@app.route('/score')
def score():
winners = db.winners
winner_list = winners.find(
{},
{
"_id": 0,
"dept_id": 1,
"event_id": 1,
"position": 1,
"points_scored": 1,
"winner_name": 1,
},
)

for winner in winner_list:
print(winner)

departments = db.department
department_list = departments.find(
{},
{
"_id":1,
"dept_name":1
},
)

# id_to_name = {}
# for entry in department_list:
# id_to_name[entry['_id']] = entry['dept_name']
winner_list = winners.find(
{},
{
"_id": 0,
"dept_id": 1,
"event_id": 1,
"position": 1,
"points_scored": 1,
"winner_name": 1,
},
)
dept_scores = defaultdict(int)
for winner in winner_list:
# print(winner)
dept_scores[winner['dept_id']] += int(winner['points_scored'])

print(dept_scores)

score = []
for entry in department_list:
score.append([entry['dept_name'], dept_scores[entry['_id']]])
# print(entry)

print(score)

score.sort(key=lambda x:x[0], reverse=False)
score.sort(key=lambda x:x[1], reverse=True)



return render_template('score.html', dept_points = score)

@app.route('/admin', methods=['GET', 'POST'])
def admin():
if request.method == 'GET':

events = db.events
department = db.department
winners = db.winners

event_list = events.find(
{},
{
"_id": 0,
"event_id": 1,
"event_name": 1,
"date": 1,
"time_begin": 1,
"time_end": 1,
"venue": 1,
"max_points": 1,
"google_form_link": 1,
"start_hour" : 1
},
)
dept_list = department.find(
{},
{
"_id": 0,
"dept_id": 1,
"dept_name": 1,
},
)


return render_template('admin.html', events = event_list, depart = dept_list)
else:
password = request.form.get("password")
points = request.form.get("points")
winner_name = request.form.get("winner_name")
event = request.form.get("event")
position = request.form.get("position")
dept = request.form.get("dept")

print(password, points, winner_name, event, position, dept)

if password != "asswin":
return "Fuck off"


db.update_winner(event, dept, position, points, winner_name)
return "Winner Updated"




# @app.route('/events')
# def events():
# print('Request for events page received')
# return render_template('events.html')


if __name__ == '__main__':
Expand Down
Loading