Skip to content

Commit

Permalink
Merge pull request #9 from kbhutani0001/revert-8-ShowMultiple
Browse files Browse the repository at this point in the history
Revert "Show multiple"
  • Loading branch information
kaybhutani authored Oct 11, 2018
2 parents 005d394 + 7949ffe commit 2599d02
Show file tree
Hide file tree
Showing 2,296 changed files with 1,258 additions and 744,800 deletions.
108 changes: 57 additions & 51 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,57 @@
# importing files
from flask import Flask, render_template, request

import firstyear
import fourthyear
import secondyear
import thirdyear

# app name
app = Flask(__name__)


# app route for main page
@app.route('/', methods=['GET', 'POST'])
def home():
# deleting all file in the folder
# folder = 'static/temp/'
# for the_file in os.listdir(folder):
# file_path = os.path.join(folder, the_file)
# try:
# if os.path.isfile(file_path):
# os.unlink(file_path)
# except Exception as e:
# print(e)
if request.method == 'GET':
return render_template("index.html")
elif request.method == 'POST':

year = int(request.form.get('year'))
batch = request.form.get('batch').upper()
# returning dictionary from module
if year == 2:
tt_dict = secondyear.second(batch)
elif year == 3:
tt_dict = thirdyear.third(batch)
elif year == 1:
tt_dict = firstyear.first(batch)
elif year == 4:
tt_dict = fourthyear.fourth(batch)

try:

pass
except Exception as e:
return render_template("timetable.html", tt_dict=tt_dict)

return render_template("timetable.html", tt_dict=tt_dict)


if (__name__ == '__main__'):
app.run(debug=True, use_reloader=True)
#importing files
from flask import Flask,render_template,request,redirect,url_for,send_from_directory
import os
import imgkit
import secondyear
import thirdyear
import firstyear
import fourthyear


#app name
app=Flask(__name__)


#app route for main page
@app.route('/', methods=['GET', 'POST'])
def home():
#deleting all file in the folder
# folder = 'static/temp/'
# for the_file in os.listdir(folder):
# file_path = os.path.join(folder, the_file)
# try:
# if os.path.isfile(file_path):
# os.unlink(file_path)
# except Exception as e:
# print(e)
if request.method == 'GET':
return render_template("index.html")
elif request.method == 'POST':

year=int(request.form.get('year'))
batch=request.form.get('batch').upper()
#returning dictionary from module
if year==2:
tt_dict=secondyear.second(batch)
elif year==3:
tt_dict=thirdyear.third(batch)
elif year==1:
tt_dict=firstyear.first(batch)
elif year==4:
tt_dict=fourthyear.fourth(batch)

try:


pass
except Exception as e:
return render_template("timetable.html",tt_dict=tt_dict)





return render_template("timetable.html",tt_dict=tt_dict)

if(__name__=='__main__'):
app.run(debug=True,use_reloader=True)
150 changes: 67 additions & 83 deletions firstyear.py
Original file line number Diff line number Diff line change
@@ -1,90 +1,74 @@
import numpy as np
import pandas as pd

pd.set_option('display.max_colwidth', -1)
pd.set_option('float_format', '{:f}'.format)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
np.set_printoptions(threshold=np.nan)

import xlrd

def first(batch):
index_col_2_yr = "B.TECH. Ist Yr TIMETABLE ODD SEMESTER 2018, JIIT-128(Effective from 12/09/2018)"

timetable = pd.read_excel("timetable1.xlsx", index_col=index_col_2_yr)

timetable.columns = [1, 2, 3, 4, 5, 6, 7, 8, 9]

timetable.columns.name = " "

# separating days

mon = timetable.loc["MON":"TUES"].iloc[:-1]
tue = timetable.loc["TUES":"WED"].iloc[:-1]
wed = timetable.loc["WED":"THUR"].iloc[:-1]
thu = timetable.loc["THUR":"FRI"].iloc[:-1]
fri = timetable.loc["FRI":"SAT"].iloc[:-1]
sat = timetable.loc["SAT":].iloc[:-1]

days = [mon, tue, wed, thu, fri, sat]

classdict = {'P': 'Practical', 'L': 'Lecture', 'T': 'Tutorial'}

lecturerDict = {'AB': 'Anshu Banwari', 'NC': 'Nilu Chaudhary', 'EKTA': 'Ekta Srivastava', 'DV': 'Deepak Verma',
'RG': 'Ruchi Gautam', 'DCB': 'DINESH BISHT', 'SHARIQ': 'SHARIQ MURTAZA',
'SUK': 'SUDHANSHU KULSHRESTHA',
'VARSHA': 'VARSHA GARG', 'AVP': 'AVINASH CHANDRA PANDEY', 'BDJ': 'BANSIDHAR JOSHI', 'CG': 'CHARU',
'DVP': 'DEVPRIYA SONI', 'GN': 'GAURAV KUMAR NIGAM', 'GS': 'GAURAV SAXENA', 'HB': 'HIMANI BANSAL',
'HA': 'HIMANSHU AGRAWAL', 'HM': 'HIMANSHU MITTAL', 'KA': 'KRISHNA ASAWA', 'KM': 'KRITIKA RANI',
'MS': 'MUKESH SARASWAT', 'PM': 'PULKIT MEHNDIRATTA', 'RP': 'RAJU PAL', 'RA': 'RAVINDER AHUJA',
'SP': 'SANJEEV', 'AV': 'Dr. Amit Verma', 'ADV': 'Dr. Anshu D Varshney',
'PC': 'Dr. Prashant Chauhan',
'SD': 'Dr. Sandeep Chooker', 'SCK': 'Prof. S C Katyal', 'SKA': 'Dr. S K Awasthi',
'VM': 'Dr. Vikas Malik',
'SKV': 'SANTOSH KUMAR VERMA', 'AKB': 'AKANKSHA BHARDWAJ', 'AM': 'AMBALIKA SARKAR',
'AKH': 'ANKUR KULHARI',
'AR': 'ANUBHUTI RODA MOHINDRA', 'ARG': 'ANURADHA GUPTA', 'AVP': 'AVINASH CHANDRA PANDEY',
'ARTI': 'ARTI JAIN', 'ASH': 'ASHISH TRIPATHI'}

subjectdict = {'GE111': 'Engineering Drawing & Design', 'MA111': 'Mathematics-1', 'PH111': 'Physics-I',
'GE112': 'Workshop', 'CI111': 'Software Development Fundamentals-I', 'PH171': 'Physics lab-I',
'HS112': 'English', 'CI171': 'Software development lab-I'}

rows = []

for i in range(len(days)): # Number of days
newlist = []
for j in range(1, 10): # Number of classes per day
classes_in_slot = list(days[i][j].dropna())
haveClasses = [i for i in range(len(classes_in_slot)) if
batch in classes_in_slot[i] or 'ALL' in classes_in_slot[i]]
toShow = ''
for hc in haveClasses:
temp = classes_in_slot[hc].replace("\n", "")
for cls in temp.split(', '):
typeofclass = cls[0]
roomNum = cls[cls.index('-') + 1:cls.index('/')] if (('-') in cls and ('/') in cls) else ""
subject = cls[cls.index('(') + 1:cls.index(')')] if ('(' in cls and (')') in cls) else ""
lecturer = cls[cls.index('/') + 1:] if (('-') in cls and ('/') in cls) else ""

typeofclass = classdict[cls[0]] if typeofclass in classdict else typeofclass
subject = subjectdict[subject] if subject in subjectdict else subject
lecturer = lecturerDict[lecturer] if lecturer in lecturerDict else lecturer

clsDetails = '[' + typeofclass + '][' + subject + '][' + roomNum + '][' + lecturer + ']'
toShow += clsDetails + '~'

# print('toShow is ', toShow)
newlist.append(toShow[:-1])
# print('newlist is \n', newlist,'\n')

index_col_2_yr="B.TECH. Ist Yr TIMETABLE ODD SEMESTER 2018, JIIT-128(Effective from 12/09/2018)"

data=pd.read_excel("timetable1.xlsx", index_col=index_col_2_yr)
#sperating cols

data.columns=[1,2,3,4,5,6,7,8,9]

data.columns.name=" "

#seprating days

mon=data.loc["MON":"TUES"].iloc[:-1]
tue=data.loc["TUES":"WED"].iloc[:-1]
wed=data.loc["WED":"THUR"].iloc[:-1]
thu=data.loc["THUR":"FRI"].iloc[:-1]
fri=data.loc["FRI":"SAT"].iloc[:-1]
sat=data.loc["SAT":].iloc[:-1]



#list of df
data2=[mon,tue,wed,thu,fri,sat]

final=data.dropna()
#data2
#final=data.dropna()
#final
#edit data frame here . make first row the column labels

rows=[]



#realgame
#move all to class and fns

for i in range (0,6):
newlist=[]
for j in range(1,10):
new=data2[i][j].dropna()
new2=new.str.contains(batch)
new3=new.str.contains('ALL')
new2=new2|new3
if not ((new[new2]).empty):
temp=new[new2].tolist()[0].replace("\n","")

#comment to show subject code
# temp1=temp.find('(')
# temp2=temp.find(')')
# temp=temp[:temp1]+temp[temp2+1:]
#comment to show subject code

temp3=temp.find('/')
temp=temp[:temp3]
newlist.append(temp)
#method 2
#newlist.append(new[new2].tolist().replace('\n',''))
else:
newlist.append(" ")
rows.append(newlist)

final = pd.DataFrame(rows, index=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], columns=timetable.iloc[0])
final.columns.name = "Days/Time"

return final.transpose().to_dict('list')

#final.append(new[new2])
#final

# e7 = first("F5")
final=pd.DataFrame(rows,index=["Mon","Tue","Wed","Thu","Fri","Sat"],columns=data.iloc[0])
final.columns.name="Days/Time"

# for k in e7.keys():
# print(k, '->\n', e7[k])
return(final.transpose().to_dict('list'))
Loading

0 comments on commit 2599d02

Please sign in to comment.