-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbackupsettting.txt
243 lines (239 loc) · 6.57 KB
/
backupsettting.txt
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
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from app.models import *
from app.trycheck import *
from django.http import HttpResponse
from google.appengine.api import memcache
import csv
import time
import datetime
from app.grading import *
from app.maketable import *
def adminpage(request):
return render(request,'admin.html',{})
def start(request):
name=request.session['name']
t=datetime.time()
request.session['starttime'] = int(t)
return render(request, 'index.html',{'name':name})
def register(request):
'''for key in request.session.keys():
del request.session[key]'''
#obj=django_session(id=NULL,session_key=NULL,session_data=NULL,expire_date=NULL)
#obj.save()
return render(request, 'Login.html',{})
def login(request):
return render(request, 'Reg.html',{})
def checkscorepage(request):
obj=EssayData.objects.all()
email=request.session['email']
d=0
context={}
b1=''
b2=''
b3=''
b4=''
b5=''
b6=''
ob=HtmlData.objects.all()
for elt in ob:
if elt.filename=='t1':
b1=elt.code
break
for elt in ob:
if elt.filename=='t2':
b2=elt.code
break
for elt in ob:
if elt.filename=='t3':
b3=elt.code
break
for elt in ob:
if elt.filename=='t4':
b4=elt.code
break
for elt in ob:
if elt.filename=='t5':
b5=elt.code
break
for elt in ob:
if elt.filename=='t6':
b6=elt.code
break
table=''
for elt in obj:
if elt.userid==email:
d=1
data=b1+elt.topic+b2+elt.grade+b2+elt.wordcount+b3+elt.spellcheck+b4+elt.grammercheck+b5+elt.articlecheck+b5+elt.error+b5+elt.timetaken+b5+elt.totaltime+b6
table=table+data
if d==1:
return render(request, "CheckScore.html" , {'data':table})
else:
return render(request, "CheckScore.html" , {})
def opencohession(request):
name=request.session['name']
return render(request,'Cohession.html',{'name':name})
@csrf_exempt
def checkcohession(request):
if request.method=="POST":
topic=request.POST.get('Topic')
text=request.POST.get('text')
result=check_cohession(text[3:len(text)-4],topic)
p_rep=str(result['Phrase repitions'])
s_rep=str(result['Sentence repitions'])
preplex_score=str(result['Preplexity score'])
relevance=str(result['RElevance Score'])
para=str(result['Paragraphs'])
b1=''
b2=''
b3=''
ob=HtmlData.objects.all()
for elt in ob:
if elt.filename=='t1':
b1=elt.code
break
for elt in ob:
if elt.filename=='t2':
b2=elt.code
break
for elt in ob:
if elt.filename=='t6':
b3=elt.code
break
table=''
table=b1+p_rep+b2+s_rep+b2+preplex_score+b2+relevance+b2+para+b3
context = {
'data':table,
'topic':topic
}
return render(request, 'CheckCohession.html',context)
@csrf_exempt
def checkscore(request):
if request.method=="POST":
#obj=EssayData.objects.all().delete()
#Calculating Time Taken
starttime = request.session['starttime']
currenttime=int(time.time())
timetaken = (currenttime-starttime)
topic = request.POST.get('Topic')
data = request.POST.get('text')
print(data[3:len(data)-4])
obj=EssayData.objects.all()
count = str(data[3:len(data)-4]).split()
length = len(count)
spell = Check_spelling(str(data))
grammer = Capitalize(str(data[3:len(data)-4]))
art=check_articles(str(data))
Graded_result=Main_fun()
totalerror=int(spell)+int(grammer)+int(art)
obj=EssayData(userid=request.session['email'],topic=topic,essay=data,wordcount=length,spellcheck=spell,grammercheck=grammer,articlecheck=art,error=totalerror,grade=Graded_result,totaltime=60,timetaken=timetaken)
mail_id=request.session['email']
obj.save()
data_scores=[mail_id,topic,data,length,spell,grammer,art,Graded_result]
f=open('ScoreData.csv','a')
writer=csv.writer(f)
writer.writerow(data_scores)
f.close()
b1=''
b2=''
b3=''
b4=''
b5=''
b6=''
ob=HtmlData.objects.all()
for elt in ob:
if elt.filename=='t1':
b1=elt.code
break
for elt in ob:
if elt.filename=='t2':
b2=elt.code
break
for elt in ob:
if elt.filename=='t3':
b3=elt.code
break
for elt in ob:
if elt.filename=='t4':
b4=elt.code
break
for elt in ob:
if elt.filename=='t5':
b5=elt.code
break
for elt in ob:
if elt.filename=='t6':
b6=elt.code
break
table=''
obj=EssayData.objects.all()
for elt in obj:
if elt.userid==request.session['email']:
d=1
data=b1+elt.topic+b2+elt.grade+b2+elt.wordcount+b3+elt.spellcheck+b4+elt.grammercheck+b5+elt.articlecheck+b5+elt.error+b5+elt.timetaken+b5+elt.totaltime+b6
table=table+data
return render(request, "CheckScore.html" , {'data':table})
def analyticspage(request):
return render(request, 'Analytics.html',{})
def rulespage(request):
return render(request, 'Rules.html',{})
def contactpage(request):
return render(request, 'Contact.html',{})
@csrf_exempt
def saveuser(request):
if request.method=="POST":
text=' '
n=request.POST.get('name')
g=request.POST.get('gender')
ph=request.POST.get('phone')
p=request.POST.get('password')
e=request.POST.get('email')
ob=UserData.objects.all()
d=0
for elt in ob:
if e==elt.email:
d=1
break
if d==0:
obj=UserData(name=n,password=p,email=e,gender=g,phone=ph,status='N')
obj.save()
request.session['userid'] = e
text='Account Created Successfully'
context={'text':text,
'name':n}
return render(request,'policy.html',context)
else:
text='User Already Exists'
context={'text':text}
return render(request,'regresult.html',context)
@csrf_exempt
def checklogin(request):
text=" "
d=0
e=request.POST.get('email')
p=request.POST.get('password')
obj=UserData.objects.all()
name=''
for elt in obj:
if e==elt.email and p==elt.password and elt.status=='Y':
d=1
name=elt.name
request.session['email'] = e
request.session['name'] = elt.name
break
elif e==elt.email and p==elt.password and elt.status=='N':
#request.session['userid'] = e
memcache.add(key="userid", value=str(e), time=3600)
text=' '
context={'text':text,
'name':elt.name}
return render(request,'policy.html',context)
break
if d==0:
con={'text':"No User Found"}
return render(request,"regresult.html",con)
else:
return render(request,'start.html',{'name':name})
def acceptpolicy(request):
obj=UserData.objects.filter(email=memcache.get(key="userid")).update(status="Y")
return render(request,'Reg.html',{})