def index(request, problem_name): problem = Problem.objects.get(p_name=problem_name) #try: # s_rate = (((problem.success_sub*1.0) / problem.tot_sub)*100) #except : # s_rate = 0 #s_rate = (str)(round(s_rate,2)) contest = problem.Contest session = Problem_session.objects.get(Problem=problem).c_session_code user = get_object_or_404(User, username=get_u(request)) Us_Pro = User_Problem.objects.filter(User=user, Problem=problem).first() Submission = apps.get_model(app_label='Leader', model_name="Sub_cont_" + str(problem.Contest.id)) all_sub = Submission.objects.filter(User=user, Problem=problem) meta = ['id', 'time', 'pts', 'Lang'] time = contest.start_time time = time.replace(microsecond=0) sub_table = create.get_sub(all_sub, meta, time) meta = ['Code', 'Sub time', 'Score', 'Lang'] if Us_Pro is None: return render( request, 'submission/Drop.html', { 'session': session, 'Lang': 'c', 'problem': problem, 'contest': contest, 'sub_all': sub_table, 'fields': meta, 'end': str(contest.end_time)[:16:], 'Rank': get_rank(user.id, contest.id), 'S_Rate': problem.s_rate }) else: if Us_Pro.last_lang == 'c': session = Us_Pro.c_session_code elif Us_Pro.last_lang == 'c_cpp': session = Us_Pro.cpp_session_code elif Us_Pro.last_lang == 'java': session = Us_Pro.java_session_code elif Us_Pro.last_lang == 'python': session = Us_Pro.py_session_code elif Us_Pro.last_lang == 'python3': session = Us_Pro.py3_session_code return render( request, 'submission/Drop.html', { 'session': session, 'Lang': Us_Pro.last_lang, 'problem': problem, 'contest': contest, 'sub_all': sub_table, 'fields': meta, 'end': str(contest.end_time)[:16:], 'Rank': get_rank(user.id, contest.id), 'Status': Us_Pro.status, 'S_Rate': problem.s_rate })
def leader(request, cont_id): cont = apps.get_model(app_label='Leader', model_name="cont_" + str(cont_id)) meta = create.splitm(cont._meta.get_fields()) contest_temp = Contest.objects.get(id=cont_id) time = contest_temp.start_time contest = Contest.objects.get(id=cont_id) time = time.replace(microsecond=0) res = cont.objects.all() events = create.get_table(res, meta, time) user = get_object_or_404(User, username=get_u(request)) #field=cont._meta.fields() meta[0] = 'Rank' meta[1] = 'User' meta[2] = 'Time' meta[3] = 'Score' return render( request, 'Leader/index.html', { 'participents': events, 'fields': meta, 'cont_id': cont_id, 'time': time, 'contest': contest, 'end': str(contest.end_time)[:16:], 'Rank': get_rank(user.id, contest.id) })
def change(request, problem_id): if request.method == 'POST': user = get_u(request) user = get_object_or_404(User, username=user) problem = get_object_or_404(Problem, id=problem_id) Us_Pro = User_Problem.objects.filter(User=user, Problem=problem).first() #print (Us_Pro) Lang = request.POST.get('lang') if Lang == 'c': if Us_Pro is None or Us_Pro.c_session_code is None: session = Problem_session.objects.get(Problem=problem) return HttpResponse(session.c_session_code) return HttpResponse(Us_Pro.c_session_code) elif Lang == 'c_cpp': if Us_Pro is None or Us_Pro.cpp_session_code is None: session = Problem_session.objects.get(Problem=problem) return HttpResponse(session.cpp_session_code) return HttpResponse(Us_Pro.cpp_session_code) elif Lang == 'java': if Us_Pro is None or Us_Pro.java_session_code is None: session = Problem_session.objects.get(Problem=problem) return HttpResponse(session.java_session_code) return HttpResponse(Us_Pro.java_session_code) elif Lang == 'python': if Us_Pro is None or Us_Pro.py_session_code is None: session = Problem_session.objects.get(Problem=problem) return HttpResponse(session.py_session_code) return HttpResponse(Us_Pro.py_session_code) elif Lang == 'python3': if Us_Pro is None or Us_Pro.py3_session_code is None: session = Problem_session.objects.get(Problem=problem) return HttpResponse(session.py3_session_code) return HttpResponse(Us_Pro.py3_session_code)
def disc(request, contest_id): contest = Contest.objects.get(id=contest_id) user = get_object_or_404(User, username=get_u(request)) return render( request, 'discussion/forum.html', { 'All': Discussion.objects.filter(contest=contest).order_by('-id'), 'contest_id': contest_id, 'contest': contest, 'end': str(contest.end_time)[:16:], 'Rank': get_rank(user.id, contest.id) })
def addcom(request): user = User.objects.filter(username=get_u(request)).first() con = request.POST.get('con') contest = Contest.objects.get(id=con) message = request.POST.get('comment') time = datetime.datetime.now().replace(microsecond=0) discussion = Discussion(user=user, contest=contest, message=message, time=time) discussion.save() con_name = contest.con_name.replace(" ", "_") Group(con_name).send({ 'text': '<div class="comment"><div class="content"><a class="author">' + str(discussion.user.username) + '</a><div class="metadata"><div class="date">' + str(discussion.time) + '</div></div><pre class="ui segment" style="background-color: #f8f8f8;border:0px;">' + str(discussion.message) + '</pre></div></div>' }) return HttpResponse("success")
def index(request): get_object_or_404(AdminUser,user=get_object_or_404(User,username=get_u(request))) data=Contest.objects.all(); return render(request,'adminpanel/addqus.html',{'data':data})
def run(request, problem_id): if request.method == 'POST': time_out = False user = get_u(request) code = request.POST.get('code') Lang = request.POST.get('lang') status = request.POST.get('Check_Status') errors = '' user = get_object_or_404(User, username=user) problem = get_object_or_404(Problem, id=problem_id) #print status,"-------" if status == "yes": input_from_user = request.POST.get('input') else: input_from_user = problem.sample_input #print (problem) Us_Pro = User_Problem.objects.filter(User=user, Problem=problem).first() #print (Us_Pro) if Us_Pro is None: Us_Pro = User_Problem(User=user, Problem=problem, sub_cnt=0) problem.tot_sub += 1 problem.save() Us_Pro.save() if Lang == 'c': Us_Pro.c_session_code = code Us_Pro.last_lang = 'c' Us_Pro.save() file_name = 'All/' + user.username + '/c/Solution.c' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('gcc All/' + user.username + '/c/Solution.c -o All/' + user.username + "/c/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre>") else: ans = '' #print ('test') command = subprocess.Popen("./All/" + user.username + "/c/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(input_from_user) command.stdin.close() timeout = AdminSettings.objects.get(id=1).c_time ans, time_out = getO(command, timeout, user) if time_out: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + "Terminate due to timeout" + "\n\n\nYour Output : \n" + safe_escape(ans) + "</pre>") if status == "yes": return HttpResponse(safe_escape(ans)) else: if problem.sample_output == ans: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">You passed sample testcase</strong></pre>" ) else: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">Wrong output</strong></pre>" ) elif Lang == 'c_cpp': Us_Pro.cpp_session_code = code Us_Pro.last_lang = 'c_cpp' Us_Pro.save() file_name = 'All/' + user.username + '/cpp/Solution.cpp' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen( 'g++ All/' + user.username + '/cpp/Solution.cpp -o All/' + user.username + "//cpp/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre>") else: ans = '' command = subprocess.Popen("./All/" + user.username + "/cpp/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(input_from_user) command.stdin.close() timeout = AdminSettings.objects.get(id=1).cpp_time ans, time_out = getO(command, timeout, user) if time_out: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + "Terminate due to timeout" + "\n\n\nYour Output : \n" + safe_escape(ans) + "</pre>") if status == "yes": return HttpResponse(safe_escape(ans)) else: if problem.sample_output == ans: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</strong></pre><br>Result :" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">You passed sample testcase</strong></pre>" ) else: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</strong></pre><br>Result :" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">Wrong output</strong></pre>" ) elif Lang == 'java': Us_Pro.java_session_code = code Us_Pro.last_lang = 'java' Us_Pro.save() file_name = 'All/' + user.username + '/java/Solution.java' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('javac All/' + user.username + '/java/Solution.java ', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre>") else: ans = '' command = subprocess.Popen("java -cp All/" + user.username + "/java/ Solution", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(input_from_user) command.stdin.close() time.sleep(.1) timeout = AdminSettings.objects.get(id=1).java_time ans, time_out = getO(command, timeout, user) if time_out: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + "Terminate due to timeout" + "\n\n\nYour Output : \n" + safe_escape(ans) + "</pre>") if status == "yes": return HttpResponse(safe_escape(ans)) else: if problem.sample_output == ans: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">You passed sample testcase</strong></pre>" ) else: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">Wrong output</strong></pre>" ) elif Lang == 'python': Us_Pro.py_session_code = code Us_Pro.last_lang = 'python' Us_Pro.save() file_name = 'All/' + user.username + '/py/Solution.py' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('python All/' + user.username + '/py/Solution.py', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(input_from_user) command.stdin.close() timeout = AdminSettings.objects.get(id=1).py_time ans, time_out = getO(command, timeout, user) if time_out: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + "Terminate due to timeout" + "\n\n\nYour Output : \n" + safe_escape(ans) + "</pre>") if status == "yes": return HttpResponse(safe_escape(ans)) else: if problem.sample_output == ans: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + escape(ans) + "</strong></pre><br>Result :" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">You passed sample testcase</strong></pre>" ) else: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">Wrong output</strong></pre>" ) elif Lang == 'python3': Us_Pro.py3_session_code = code Us_Pro.last_lang = 'python3' Us_Pro.save() file_name = 'All/' + user.username + '/py3/Solution.py' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('python3 All/' + user.username + '/py3/Solution.py', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(input_from_user) command.stdin.close() time.sleep(1) timeout = AdminSettings.objects.get(id=1).py3_time ans, time_out = getO(command, timeout, user) if time_out: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + "Terminate due to timeout" + "\n\n\nYour Output : \n" + safe_escape(ans) + "</pre>") if status == "yes": return HttpResponse(safe_escape(ans)) else: if problem.sample_output == ans: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">You passed sample testcase</strong></pre>" ) else: return HttpResponse( "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">" + safe_escape(ans) + "</pre><p><strong class=\"header\">Result :</strong></p>" + "<pre class=\"ui segment\" style=\"background-color: #f8f8f8;border:0px;\">Wrong output</strong></pre>" )
def submit(request, problem_id): if request.method == 'POST': time_out = False user = get_u(request) code = request.POST.get('code') Lang = request.POST.get('lang') errors = '' user = get_object_or_404(User, username=user) problem = get_object_or_404(Problem, id=problem_id) #print (problem) #code = code.replace ('\n', '') Us_Pro = User_Problem.objects.filter(User=user, Problem=problem).first() if Us_Pro is None: Us_Pro = User_Problem(User=user, Problem=problem, sub_cnt=0) problem.tot_sub = problem.tot_sub + 1 problem.save() Us_Pro.save() if Lang == 'c': #Us_Pro = User_Problem.objects.get (User=user, Problem=problem) cnt = Us_Pro.sub_cnt Us_Pro.c_session_code = code Us_Pro.last_lang = 'c' Us_Pro.save() points = 0 result = '' file_name = 'All/' + user.username + '/c/Solution.c' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('gcc All/' + user.username + '/c/Solution.c -o All/' + user.username + "/c/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse(safe_escape(ans)) else: test_case = 1 for test0 in TestCase.objects.filter(Problem=problem): ans = '' #print ('test') ##print(test0) command = subprocess.Popen("./All/" + user.username + "/c/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(test0.testin) command.stdin.close() timeout = AdminSettings.objects.get(id=1).c_time ans, time_out = getO(command, timeout, user) if time_out: result += "TLE\t\t" if test_case % 4 == 0: result += '\n\n' elif (ans == test0.testout): result += 'TestCase ' + str( test_case ) + ' <i class=\"green checkmark icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' points += test0.weight else: result += 'TestCase ' + str( test_case ) + ' <i class=\"red remove icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' test_case += 1 pushindb(user, problem, points, Lang, code, result) return HttpResponse("<pre><strong>" + result + "</strong></pre>") elif Lang == 'c_cpp': #Us_Pro = User_Problem.objects.get (User=user, Problem=problem) cnt = Us_Pro.sub_cnt Us_Pro.sub_cnt += 1 Us_Pro.last_lang = 'c_cpp' Us_Pro.cpp_session_code = code Us_Pro.save() points = 0 result = '' file_name = 'All/' + user.username + '/cpp/Solution.cpp' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen( 'g++ All/' + user.username + '/cpp/Solution.cpp -o All/' + user.username + "//cpp/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse(safe_escape(ans)) else: test_case = 1 for test0 in TestCase.objects.filter(Problem=problem): ans = '' print('test0', len(test0.testin)) ##print(test0) command = subprocess.Popen("./All/" + user.username + "/cpp/" + user.username, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(test0.testin) command.stdin.close() timeout = AdminSettings.objects.get(id=1).cpp_time ans, time_out = getO(command, timeout, user) if time_out: result += "TLE\t\t" if test_case % 4 == 0: result += '\n\n' elif (ans == test0.testout): result += 'TestCase ' + str( test_case ) + ' <i class=\"green checkmark icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' points += test0.weight else: result += 'TestCase ' + str( test_case ) + ' <i class=\"red remove icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' print len(test0.testout), len(ans) test_case += 1 pushindb(user, problem, points, Lang, code, result) return HttpResponse("<pre><strong>" + result + "</strong></pre>") elif Lang == 'java': #Us_Pro = User_Problem.objects.get (User=user, Problem=problem) cnt = Us_Pro.sub_cnt Us_Pro.sub_cnt += 1 Us_Pro.java_session_code = code Us_Pro.last_lang = 'java' Us_Pro.save() points = 0 result = '' file_name = 'All/' + user.username + '/java/Solution.java' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' command = subprocess.Popen('javac All/' + user.username + '/java/Solution.java ', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) ans, err = command.communicate() subprocess.Popen('kill ' + str(command.pid), shell=True) print 'comm' #py 3.4 #ans += x django 1.11 py 2.7/ 3.4 if (len(ans) > 1): return HttpResponse(safe_escape(ans)) else: test_case = 1 for test0 in TestCase.objects.filter(Problem=problem): ans = '' #print ('test') ##print(test0) command = subprocess.Popen( "java -cp All/" + user.username + "/java/ Solution", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(test0.testin) command.stdin.close() timeout = AdminSettings.objects.get(id=1).java_time ans, time_out = getO(command, timeout, user) if time_out: result += "TLE\t\t" if test_case % 4 == 0: result += '\n\n' elif (ans == test0.testout): result += 'TestCase ' + str( test_case ) + ' <i class=\"green checkmark icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' points += test0.weight else: result += 'TestCase ' + str( test_case ) + ' <i class=\"red remove icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' test_case += 1 pushindb(user, problem, points, Lang, code, result) return HttpResponse("<pre><strong>" + result + "</strong></pre>") elif Lang == 'python': #Us_Pro = User_Problem.objects.get (User=user, Problem=problem) cnt = Us_Pro.sub_cnt Us_Pro.sub_cnt += 1 Us_Pro.py_session_code = code Us_Pro.last_lang = 'python' Us_Pro.save() points = 0 result = '' file_name = 'All/' + user.username + '/py/Solution.py' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' test_case = 1 for test0 in TestCase.objects.filter(Problem=problem): ans = '' #print ('test') ##print(test0) command = subprocess.Popen('python All/' + user.username + '/py/Solution.py', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(test0.testin) command.stdin.close() timeout = AdminSettings.objects.get(id=1).py_time ans, time_out = getO(command, timeout, user) if time_out: result += "TLE\t\t" if test_case % 4 == 0: result += '\n\n' elif (ans == test0.testout): result += 'TestCase ' + str( test_case ) + ' <i class=\"green checkmark icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' points += test0.weight else: result += 'TestCase ' + str( test_case) + ' <i class=\"red remove icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' test_case += 1 pushindb(user, problem, points, Lang, code, result) return HttpResponse("<pre><strong>" + result + "</strong></pre>") elif Lang == 'python3': #Us_Pro = User_Problem.objects.get (User=user, Problem=problem) cnt = Us_Pro.sub_cnt Us_Pro.sub_cnt += 1 Us_Pro.last_lang = 'python3' Us_Pro.py3_session_code = code Us_Pro.save() points = 0 result = '' file_name = 'All/' + user.username + '/py3/Solution.py' file = open(file_name, 'w') file.write(code) file.close() #print ('File created') ans = '' test_case = 1 for test0 in TestCase.objects.filter(Problem=problem): ans = '' #print ('test') #print(test0) command = subprocess.Popen('python3 All/' + user.username + '/py3/Solution.py', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE) #print ("testing .out created") command.stdin.write(test0.testin) command.stdin.close() timeout = AdminSettings.objects.get(id=1).py3_time ans, time_out = getO(command, timeout, user) if time_out: result += "TLE\t\t" if test_case % 4 == 0: result += '\n\n' elif (ans == test0.testout): result += 'TestCase ' + str( test_case ) + ' <i class=\"green checkmark icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' points += test0.weight else: result += 'TestCase ' + str( test_case) + ' <i class=\"red remove icon\"></i>\t\t' if test_case % 4 == 0: result += '\n\n' test_case += 1 pushindb(user, problem, points, Lang, code, result) return HttpResponse("<pre><strong>" + result + "</strong></pre>")