-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
636 lines (537 loc) · 47 KB
/
app.py
File metadata and controls
636 lines (537 loc) · 47 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
from fileinput import filename
import os
from flask import Flask,request,redirect,session,flash,render_template,send_file
from flask.helpers import url_for
from mysqlx import Statement
from MainDatabase import *
from flask.templating import render_template
import threading,time
from scores import updateScore
from datetime import date, timedelta, datetime
from codeforcesProblems_ContestDetails import updateCodeforcesProblems_Contests
from ActiveContests import getActiveContests
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask_mail import Mail,Message
import openpyxl
app = Flask(__name__)
app.secret_key = "loveYou3000"
app.permanent_session_lifetime = timedelta(days=2)
app.config['hello'] = "hello"
app.config['MAIL_SERVER'] = 'smtp.googlemail.com'
app.config['MAIL_PORT'] = 587
app.config['MAIL_USE_TLS'] = True
app.config['MAIL_USERNAME'] = os.environ.get('email_id')
app.config['MAIL_PASSWORD'] = os.environ.get('email_password')
mail = Mail(app)
currentDate = date.today().strftime("%Y-%m-%d")
@app.route('/')
def home():
return render_template('home.html')
#Faculty Portal
@app.route('/fac_login.html')
def facultyLogin():
#checking wheather faculty/student already logged in
if session.get("faculty") is not None:
return redirect('/FacultyDashboard')
if session.get("user") is not None:
return redirect("/")
return render_template('fac_login.html')
@app.route('/fac_login.html/validate', methods =["GET", "POST"])
def facultyValidate():
if request.method == "POST":
# getting input with name = user_name in HTML form
adminId = request.form.get("user_name")
# getting input with name = password in HTML form
password = request.form.get("password")
verdict = isValidAdmin(adminId,password)#Authenticating..
if(verdict == "successfull"):
session["faculty"] = adminId #added to session
session.permanent = True
return redirect('/FacultyDashboard')
return f'<h2>{verdict}!!!</h2>' #for Incorrect credentials
return "Sorry!!"
@app.route('/FacultyDashboard')
def Facdashboard():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
selectStatement = f'select userId,overallScore from leaderboardtable where ScoredDate="{currentDate}" order by overallScore DESC limit 3'
mycursor.execute(selectStatement+";")
top3Scorers = tuple(mycursor.fetchall())
past30Days = (datetime.now() - timedelta(30)).strftime("%Y-%m-%d")
past30Statement = f'select userId,overallScore from leaderboardtable where ScoredDate="{past30Days}"'
maxStreakStatement = f'select a.userId as userId,a.overallScore-b.overallScore as overallScore from ({selectStatement}) as a inner join ({past30Statement}) as b on a.userId=b.userId order by overallScore DESC limit 3;'
mycursor.execute(maxStreakStatement)
recentTop3 = tuple(mycursor.fetchall())
return render_template('FacHomePage.html',data= top3Scorers,data2 = recentTop3)
return redirect('/')
@app.route('/fac_register.html', methods =["GET", "POST"])
def facultySignUp():
return render_template('fac_register.html')
@app.route('/fac_register.html/validate', methods =["GET", "POST"])
def facultyRegistration():
if request.method == "POST":
adminId = request.form.get("user_name")# getting input with name = user_name in HTML form
password = request.form.get("password")# getting input with name = password in HTML form
email = request.form.get("email") # getting input with name = email in HTML form
status = addAdmin(adminId,password,email)
if(status == "Successfull!!!"):
return redirect('/fac_login.html')
return status
return "Sorry"
@app.route('/ChangeUserPassword')
def ChangeUserPassByAdmin():
if session.get("faculty") is not None:
return render_template('/changeUserPassByAdmin.html')
return redirect("/")
@app.route('/ChangeUserPassword/validate',methods =["GET", "POST"])
def ChangeUserPassByAdminValidate():
if request.method == "POST" and session.get("faculty") is not None:
userId = request.form.get("user")# getting input with name = password in HTML form
status = isValidStudent(userId,"")#authenticating...
if status != "user doesn't exists":
updateStatus = updateStudentPassword(userId,"12345")
if updateStatus != "True":
return updateStatus
else:
flash('User Password changed Successfully!!!','success')
return redirect('/adminLeaderboard')
else:
return status
return redirect("/logout")
@app.route('/Comapnies', methods =["GET", "POST"])
def AdminComapnies():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
countOfTR = 'select count(*) from placements as b where b.company_name = a.name and b.package = a.package and b.level_of_clearence in ("TR","HR")'
countOfPlace = 'select count(*) from placements as b where b.company_name = a.name and b.package = a.package and b.level_of_clearence = "CLR"'
statement = f'select a.company_id,a.name,a.package, ({countOfTR}) as interviewCount,({countOfPlace}) as Cleared ,CASE WHEN a.campus_hiring THEN "On-Campus" ELSE "Off-Campus" END as placement from company as a;'
mycursor.execute(statement)
data = mycursor.fetchall()
data = tuple(data)
return render_template('admin_companies.html',data = data)
return redirect('/')
@app.route('/adminLeaderboard', methods =["GET", "POST"])
def admintable():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
statement = f'select a.userId,b.phone,b.email,a.codechef,a.codeforces,a.interviewbit,a.spoj,a.leetcode,a.overallScore from leaderboardtable as a inner join userdetails as b on a.userId = b.userId where scoredDate="{currentDate}" order by a.overallScore desc,a.userId'
mycursor.execute(statement)
data = mycursor.fetchall()
data = tuple(data)
headings = ("Roll No.","Phone","email","CodeChef","CodeForces","InterviewBit","Spoj","LeetCode","Total Score")
return render_template('admin_leaderboard.html',headings=headings,data=data,filterStatus= True)
return redirect('/')
@app.route('/adminLeaderboardFilter', methods =["GET", "POST"])
def adminFiltertable():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
if request.method == "POST":
startDate = request.form.get("startDate")# getting input with name = user_name in HTML form
endDate = request.form.get("endDate")# getting input with name = password in HTML form
#records according to start date
startStatement = f'select userId,codechef,codeforces,interviewbit,spoj,leetcode,overallScore from leaderboardtable where scoredDate="{startDate}"'
#records according to end date
endStatement = f'select userId,codechef,codeforces,interviewbit,spoj,leetcode,overallScore from leaderboardtable where scoredDate="{endDate}"'
#scored between start and end date
currentStatement = f'select a.userid as userId,b.codechef-a.codechef as codechef,b.codeforces-a.codeforces as codeforces, b.interviewbit-a.interviewbit as interviewbit, b.spoj-a.spoj as spoj, b.leetcode-a.leetcode as leetcode, b.overallScore-a.overallScore as overallScore from ({startStatement}) as a,({endStatement}) as b where a.userId=b.userId'
finalStatement = f'select c.userId,d.phone,d.email,c.codechef,c.codeforces,c.interviewbit,c.spoj,c.leetcode,c.overallScore from ({currentStatement}) as c inner join userdetails as d on c.userId = d.userId order by c.overallScore desc, c.userId'
headings = ("Roll No.","Phone","email","CodeChef","CodeForces","InterviewBit","Spoj","LeetCode","Total Score")
mycursor.execute(finalStatement)
data = mycursor.fetchall()
data = tuple(data)
return render_template('admin_leaderboard.html',headings=headings,data=data,filterStatus=True)
return redirect('/')
@app.route('/Faculty/CRTstatistics')
def CrtStatistics():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
countOfClearedStatement = 'select count(*) from placements as c where a.user_id = c.user_id and c.level_of_clearence = "CLR" group by c.user_id'
countOfUnClearedStatement = 'select count(*) from placements as c where a.user_id = c.user_id and c.level_of_clearence <> "CLR" group by c.user_id'
lOCStatement = 'CASE WHEN a.level_of_clearence = "CLR" THEN "Placed" ELSE a.level_of_clearence END'
HiringStatement = 'select CASE WHEN b.campus_hiring THEN "On-Campus" ELSE "Off-Campus" END from company as b where b.name = a.company_name limit 1'
statement = f'select a.user_id,u.branch,u.email,a.company_name,a.package,({lOCStatement}),({countOfClearedStatement}),({countOfUnClearedStatement}),u.PassedOut,({HiringStatement}) as Hiring from placements as a inner join userdetails as u on a.user_id = u.userId order by a.user_id ASC;'
# print(statement)
mycursor.execute(statement)
data = mycursor.fetchall()
data = tuple(data)
return render_template('crtStatistics.html',data = data)
return redirect('/')
@app.route('/Faculty/Filters',methods =["GET", "POST"])
def applyFilters():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
userId = request.form.get("userId")
branch = request.form.get("branch")
company = request.form.get("company")
package = request.form.get("package")
level_of_clearance = request.form.get("LOC")
placedCount = request.form.get("placedCount")
unplacedCount = request.form.get("unplacedCount")
#yop = request.form.get("yop")
condition = 'where 1 = 1'
# print(userId)
if(userId != ""):
condition += f' and user = "{userId}"'
if(branch != ""):
condition += f' and branch = "{branch}"'
if(company != ""):
condition += f' and company = "{company}"'
if(package != ""):
package = float(package)
condition += f' and package <= {package}'
if(level_of_clearance != ""):
condition += f' and loc = "{level_of_clearance}"'
if(placedCount != ""):
placedCount= int(placedCount)
condition += f' and placedCount = {placedCount}'
if(unplacedCount != ""):
unplacedCount = int(unplacedCount)
condition += f' and unplacedCount = {unplacedCount}'
countOfClearedStatement = 'select count(*) from placements as c where a.user_id = c.user_id and a.level_of_clearence = "CLR"'
countOfUnClearedStatement = 'select count(*) from placements as c where a.user_id = c.user_id and a.level_of_clearence <> "CLR"'
lOCStatement = 'CASE WHEN a.level_of_clearence = "CLR" THEN "Placed" ELSE a.level_of_clearence END'
HiringStatement = 'select CASE WHEN b.campus_hiring THEN "On-Campus" ELSE "Off-Campus" END from company as b where b.name = a.company_name limit 1'
innerStatement = f'select a.user_id as user,u.branch as branch,u.email,a.company_name as company,a.package as package,({lOCStatement}) as loc,({countOfClearedStatement}) as placedCount,({countOfUnClearedStatement}) as unplacedCount,u.PassedOut,({HiringStatement}) as Hiring from placements as a inner join userdetails as u on a.user_id = u.userId'
outerStatement = f' select * from ({innerStatement}) as innerTab {condition} order by user ASC;'
# print(outerStatement)
mycursor.execute(outerStatement)
data = mycursor.fetchall()
data = tuple(data)
return render_template('crtStatistics.html',data = data)
return redirect('/')
@app.route('/Faculty/AddCompanyPage',methods =["GET", "POST"])
def addCompanyPage():
if session.get('faculty') is not None:
return render_template('addCompany.html')
return redirect('/')
@app.route('/Faculty/AddCompany',methods =["GET", "POST"])
def addCompany():
if session.get("faculty") is not None:
mydb,mycursor = connectdatabase()
company = request.form.get("company")
package = request.form.get("package")
role = request.form.get("role")
gpa = request.form.get("gpa")
backlog = request.form.get("backlog")
branches = request.form.getlist("branch")
url = request.form.get("url")
campus_hiring = request.form.get("campus_hiring")
branch = ''.join(branches)
if(gpa != ''):
gpa = float(gpa)
if(campus_hiring == 'OnCampus'):
campus_hiring = True
else:
campus_hiring = False
if(url == ''):
url=" "
Statement = f'insert into company(name,package,role,gpa,backlogs,branch,url,campus_hiring) values("{company}",{package},"{role}",{gpa},{backlog},"{branch}","{url}",{campus_hiring});'
mycursor.execute(Statement)
mydb.commit()
selectStatement = f'select company_id from company where name = "{company}" and package = {package} and role = "{role}" and gpa = {gpa} and backlogs = {backlog} and branch = "{branch}" and url = "{url}" and campus_hiring= {campus_hiring};'
mycursor.execute(selectStatement)
compId = mycursor.fetchall()[0][0]
return redirect(f'/Faculty/DisplayList/{compId}')
return redirect('/')
def getDataBasedOnCompanyId(companyId):
mydb,mycursor = connectdatabase()
campusHiring = 'CASE WHEN campus_hiring THEN "On-Campus" ELSE "Off-Campus" END'
selectEligibility = f'select company_id,name,package,role,gpa,backlogs,branch,url,({campusHiring}) from company where company_id = {companyId}'
mycursor.execute(selectEligibility)
criteria = mycursor.fetchall()[0][1:]
package = float(criteria[1])-1.5
gpa = float(criteria[3])
backlogs = int(criteria[4])
branches = criteria[5]
maxSal = f'select max(package) from placements as p where p.user_id = u.userId and p.level_of_clearence="CLR" group by p.user_id'
selectStatement = f'select u.userId,u.name,u.email,u.branch,u.passedOut from userdetails as u where u.gpa >= {gpa} and u.backlogs <= {backlogs} and LOCATE(u.branch,"{branches}") <> 0 and ({maxSal}) < {package} order by u.branch,u.userId ASC;'
mycursor.execute(selectStatement)
data = tuple(mycursor.fetchall())
return data,criteria
@app.route('/Faculty/DisplayList/<companyId>',methods =["GET", "POST"])
def displayList(companyId):
if session.get("faculty") is not None:
data,criteria = getDataBasedOnCompanyId(companyId)
return render_template('EligibleList.html',data = data,companyId = companyId,criteria=criteria)
return redirect('/')
@app.route('/Faculty/DownloadList/<companyId>',methods =["GET", "POST"])
def downloadList(companyId):
if session.get("faculty") is not None:
data,criteria = getDataBasedOnCompanyId(companyId)
headings = ("Roll No","Name","Email","Branch","Year Of Passing")
filename = "C:/Users/SANTHOSH/Desktop/MiniProject/omnia/ExcelData.xlsx"
workbook1 = openpyxl.load_workbook(filename)
sheet1 = workbook1['Sheet1']
sheet1.delete_rows(1,sheet1.max_row)
sheet1.append(headings)
for items in data:
sheet1.append(items)
workbook1.save(filename)
return send_file(filename,attachment_filename='EligibilityList.xlsx',as_attachment=True)
return redirect('/')
#Student Portal
@app.route('/stu_login.html')
def studentLogin():
#checking wheather faculty/student is already logged in
if session.get("user") is not None:
return redirect('/dashboard')
if session.get("faculty") is not None:
return redirect("/")
return render_template('stu_login.html')
@app.route('/stu_login.html/validate', methods =["GET", "POST"])
def studentValidate():
if request.method == "POST":
adminId = request.form.get("user_name")# getting input with name = user_name in HTML form
password = request.form.get("password")# getting input with name = password in HTML form
status = isValidStudent(adminId,password)
if status=="successfull":
session["user"] = adminId
session.permanent = True
return redirect("/dashboard")
return status
return None
@app.route('/stu_register.html', methods =["GET", "POST"])
def studentSignUp():
return render_template('stu_register.html')
@app.route('/stu_register.html/validate', methods =["GET", "POST"])
def studentRegistration():
if request.method == "POST":
userId = request.form.get("user_id")# getting input with name = user_name in HTML form
password = request.form.get("password")# getting input with name = password in HTML form
codechef = request.form.get("Codechef")
codeforces = request.form.get("Codeforces")
InterviewBit = request.form.get("InterviewBit")
spoj = request.form.get("SPOJ")
leetcode = request.form.get("Leetcode")
email = request.form.get("email")
phone = request.form.get("Phone")
branch = request.form.get("branch")
name = request.form.get("user_name")
cgpa = request.form.get("cgpa")
backlogs = request.form.get("backlogs")
yop = request.form.get("yop")
cgpa = float(cgpa)
status = addStudent(userId,name,branch,cgpa,backlogs,yop,password,codechef,codeforces,InterviewBit,spoj,leetcode,email,phone)
if(status == "Successfull!!!"):
return render_template('stu_login.html')
return status
@app.route('/logout')
def logout():
if "user" in session:
session.pop("user",None)
if "faculty" in session:
session.pop("faculty",None)
return redirect('/')
@app.route('/changePassword.html',methods =["GET", "POST"])
def changePasswordPage():
if session.get("user") is not None:
return render_template('/changePassword.html')
return redirect("/")
@app.route('/changePassword.html/validate', methods =["GET", "POST"])
def changePasswordValidate():
if request.method == "POST" and session.get("user") is not None:
userId = session.get("user")# getting input with name = password in HTML form
oldPassword = request.form.get("oldPassword")
status = isValidStudent(userId,oldPassword)
if status=="successfull":
newPassword = request.form.get("newPassword")
updateStatus = updateStudentPassword(session.get("user"),newPassword)
if updateStatus != "True":
return updateStatus
else:
return "Sorry Wrong Password!!!"
return redirect("/logout")
@app.route('/dashboard', methods =["GET", "POST"])
def dashboard():
if session.get("user") is not None:
return render_template('dashboard.html')
return redirect('/')
@app.route('/challenges', methods =["GET", "POST"])
#tagline contains array of categoryName,taglinesForCategory, link for background Image
def dsaTracker():
if session.get("user") is not None:
tagline = [["Array","Harder than they seem","https://www.booleanworld.com/wp-content/uploads/2019/11/c-arrays-cover.png"],["Matrix","Tables and Logs","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSruFwK2aAnh9R9n1F5cRe9lDV6bKPt4tdk-w&usqp=CAU"],["String","THIS IS A STRING","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSCNMa1dqdHVDAlEV0nkMtx5jc5BXlmXmdF0w&usqp=CAU"],["Searching & Sorting","Best to Organize","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSmYKzfnH9ntGQZXt6iQu_yhiLTHygjeelqkg&usqp=CAU"],["LinkedList","Reverse it","data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYVFRUWFhUYGBgZGhwYGBgYGhkYGhwZGhgZHBocGBkcIS4lHB4rHxgcJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHhISHjQkJSs0NDQ0MTQ0MTQ0NDE0MTQ0NDQ0NDQ0NDQ0NDQ0MTQ0NDQ0NDQ0NDQ0NDQ0NDQ0ND80P//AABEIAJsBRQMBIgACEQEDEQH/xAAbAAABBQEBAAAAAAAAAAAAAAAFAAECAwQGB//EAEgQAAEDAQQFCAYGCAQHAAAAAAEAAhEDBB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yNX0bvcvU79MQXnqg3+XasLV+fLy/kHx5/7r4tE5kKIz0L4fgMP3b37uHbw/KBYP4cU3+4c1GRV2i/3gNOju7hM/lvJLfd3d4tkp8XO62tZ9r1gsEnvL8P/P/X0g9XpQ3/YBsQyt+v4yTL+FqeJyrV3SBhpooIEGGmjgr47/Asv7V380O0zKAAAAAElFTkSuQmCC"],["Binary Search Tree","Im sorted, maybe not","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTuxHUd9tr8e34lAVqoRTqNd6I8DGyOWzIMLQ&usqp=CAU"],["Greedy","Not too greedy","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTIWYHDBUbI1QYC4zRID8f_nLr5XGbdQ4fKRQ&usqp=CAU"],["Stacks & Queues","PUSH and POP thats it","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSjvdnyeEiPh4-qyeb6IWP7tihuic1sLsm-vg&usqp=CAU"],["Graph","Easier than they seem","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTW1hZhGH_Dm2IJJVhL8Bs4t_xdnlCivpkM9w&usqp=CAU"],["Dynamic Programming","Everyone hates it","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRn1NuBgwrX3_6eI-83di7dqJepE9Vx1GMCNQ&usqp=CAU"],["Bit Manipulation","1 and 0","https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQlkRBlCwjKA0q-0ynCm46333Ryo0iDP02Rew&usqp=CAU"]];
return render_template('dsaTracker.html',tagline=tagline)
return redirect('/')
@app.route('/challenges/<category>',methods=['GET','POST'])
def challangesPage(category):
mydb,mycursor = connectdatabase()
statement = f'SELECT * FROM dsa where topic LIKE "{category}"'
mycursor.execute(statement)
data = mycursor.fetchall()
return render_template('challenges.html',data=data,category=category)
@app.route('/MyPerformance/<userId>',methods =["GET", "POST"])
def myPerformance(userId):
uid = "18R21A1290"#default userId
if session.get("user") is not None:
uid = session["user"]
elif session.get("faculty") is not None:
uid = userId
else:
return redirect('/')
mydb,mycursor = connectdatabase()
#submission verdict details
mycursor.execute("SELECT `Accepted`,`WrongAnswer`,`TimeLimitExceed`,`CompilationError`,`RunTimeError` FROM usersubmissions WHERE userId LIKE %s",[uid])
data = mycursor.fetchall()
values = list(data)
#contest participation details
mycursor.execute('SELECT b.ContestTimeStamp FROM usercontestdetails as a inner join contestdetails as b on a.contestId=b.contestId where a.userid LIKE %s and a.platform="codeforces"',[uid])
lab = mycursor.fetchall()
mycursor.execute('SELECT a.newRating FROM usercontestdetails as a inner join contestdetails as b on a.contestId=b.contestId where a.userid LIKE %s and a.platform="codeforces"',[uid])
val = mycursor.fetchall()
mycursor.execute('SELECT codechefHandle, codeforcesHandle, interviewbitHandle, spojHandle, leetCodeHandle FROM userdetails where userid LIKE %s',[uid])
handles = mycursor.fetchall()[0]
#-------------
labels = ["Accepted","WrongAnswer","TimeLimitExceed","CompilationError","RunTimeError"]
selectStatement = f'SELECT * FROM leaderboardtable WHERE userId LIKE "{uid}" and scoredDate="{currentDate}"'
mycursor.execute(selectStatement)
leader = mycursor.fetchall()
tags = ["binarySearch","binaryTree","matrices","arrays","probabilities","implementation","math","backtracking","numberTheory","divideAndConquer","bruteforce","dp","graphs","trees","dfs","bfs","bitManipulation","strings","dataStructures","games","greedy","hashing","sorting","twopointers","Others"]
problemsSolved = []
for tag in tags:
selectStatement = f'SELECT a.problemName,a.problemId,a.problemLink FROM problemdetails as a inner join userproblemdetails as b ON a.problemId=b.problemId WHERE b.userId LIKE "{uid}" and b.verdict="ACCEPTED" and b.{tag}=true'
mycursor.execute(selectStatement)
currProblems = mycursor.fetchall()
problemsSolved.append(currProblems)
return render_template("userPerformance.html", handles = handles[2:],labels = labels, values = values, val=val, lab = lab, leader=leader, uid=uid,tags=tags, problemsSolved=problemsSolved)
@app.route('/leaderboard',methods =["GET", "POST"])
def table():
if session.get("user") is not None:
mydb,mycursor = connectdatabase()
statement = f'select userId,codechef,codeforces,interviewbit,spoj,leetcode,overallScore from leaderboardtable where ScoredDate="{currentDate}" order by overallScore desc '
mycursor.execute(statement)
data = mycursor.fetchall()
data = tuple(data)
headings = ("Roll No.","CodeChef","CodeForces","InterviewBit","Spoj","LeetCode","Total Score")
return render_template('leaderboard.html',headings=headings,data=data)
return redirect('/')
@app.route('/ActiveContests', methods =["GET", "POST"])
def currentActiveContest():
ActiveContestsList = getActiveContests()
platforms = ["hackerrank.com","codechef.com","codeforces.com","hackerearth.com","leetcode.com","spoj.com"]
return render_template("activeContests.html",platforms=platforms,contestList = ActiveContestsList)
@app.route('/profile')
def studentProfile():
if session.get("user") is not None:
uid = session.get("user")
mydb,mycursor = connectdatabase()
statement = f'select * from userdetails where userId="{uid}"'
mycursor.execute(statement)
data = mycursor.fetchall()
data = list(data)
scores_statement = f'select * from leaderboardtable where userId="{uid}" and scoredDate="{currentDate}"'
mycursor.execute(scores_statement)
scores = mycursor.fetchall()
scores = list(scores)
placement_statement = f'select company_name,level_of_clearence,package,exp from placements where user_id="{uid}"'
mycursor.execute(placement_statement)
placements = mycursor.fetchall()
placements = list(placements)
headings = ["Company","Level","CTC","Experience"]
# print(placements)
return render_template('student_profile.html',data = data,scores = scores,headings = headings,placements = placements)
return redirect('/')
@app.route('/eligibleCompanies')
def studentEligibleCompanies():
if session.get("user") is not None:
uid = session.get("user")
mydb,mycursor = connectdatabase()
statement = f'select * from userdetails where userId="{uid}"'
mycursor.execute(statement)
data = mycursor.fetchall()
data = list(data)
statement = f'select max(package) from placements where "{uid}"=user_id and level_of_clearence="CLR"'
mycursor.execute(statement)
package_statement = mycursor.fetchall()
package_statement = list(package_statement)[0]
package = package_statement[0]-1.5
statement = f'select name,package,role,campus_hiring,url from company where company.package>={package} and {data[0][2]}>=company.gpa and {data[0][3]}<=company.backlogs and locate("{data[0][4]}",company.branch)>0'
mycursor.execute(statement)
companies = mycursor.fetchall()
companies = list(companies)
return render_template('student_companies.html',companies=companies)
return redirect('/')
@app.route('/companyStatusForm/<companyName>')
def companyStatusForm(companyName):
if session.get("user") is not None:
return render_template('company_status.html',companyName=companyName)
return redirect('/')
@app.route('/updateCompanyStatus',methods=['POST'])
def updateCompanyStatus():
if session.get("user") is not None:
if request.method == "POST":
company = request.form.get("company")
ctc = request.form.get("ctc")
level = request.form.get("level")
exp = request.form.get("exp")
uid = session.get("user")
try:
mydb,mycursor = connectdatabase()
statement = f'insert into placements values("{uid}","{company}","{level}",{ctc},"{exp}")'
# print(statement)
mycursor.execute(statement)
mydb.commit()
except:
print("ERROR")
return redirect('/profile')
return redirect('/profile')
return redirect('/')
@app.route('/reset_password',methods=['GET','POST'])
def reset_request():
if request.method == "POST":
email = request.form.get("email")
if isValidStudentEmail(email):
statement = f'select userId from userdetails where email="{email}"'
mydb,mycursor = connectdatabase()
mycursor.execute(statement)
myresult = mycursor.fetchall()
s = Serializer(app.config['hello'],1800)
token = s.dumps({'user_id':myresult[0][0]}).decode('utf-8')
msg = Message('Password Reset Request',sender='noreply@demo.com',recipients=[email])
msg.body = f'''To reset your password, visit the link:
{url_for('reset_password',token=token,_external=True)}
If you did not make this request, plz ignore
'''
mail.send(msg)
else:
return "email Not Valid"
return redirect('/')
@app.route('/reset_password/<token>',methods=['GET','POST'])
def reset_password(token):
s = Serializer(app.config['hello'])
try:
user_id = s.loads(token)['user_id']
return render_template('reset.html',token=token)
except:
return None
@app.route('/restPasswordUpdate/<token>',methods=['GET','POST'])
def resetPassword(token):
if request.method == "POST":
try:
s = Serializer(app.config['hello'])
user_id = s.loads(token)['user_id']
newPassword = request.form.get("password")
status = updateStudentPassword(user_id,newPassword)
if not status:
return status
return redirect('/')
except:
return "Error"
return "error"
@app.route('/forgot.html')
def forgot_page():
return render_template('forgot.html')
def updateLeaderBoard():
while(True):
updateScore()
time.sleep(24*60*60)
def updatePlatformDetails():
while(True):
updateCodeforcesProblems_Contests()
time.sleep(7*24*60*60)
if __name__ == "__main__":
leaderBoardUpdationThread = threading.Thread(target=updateLeaderBoard)
leaderBoardUpdationThread.start()
platformDetailsUpdationThread = threading.Thread(target=updatePlatformDetails)
platformDetailsUpdationThread.start()
app.run(debug=True,host="0.0.0.0")