Commit cb539dd4 authored by dexsap's avatar dexsap

last push

parent 29281064
{
"folders": [
{
"path": "."
},
{
"path": "../IPS"
}
]
}
\ No newline at end of file
...@@ -79,40 +79,40 @@ def loginpage(request): ...@@ -79,40 +79,40 @@ def loginpage(request):
else: else:
return render(request, 'EmployeeProdDB/loginpage.html') return render(request, 'EmployeeProdDB/loginpage.html')
# def upload_csv(request): def upload_csv(request):
# if request.method == 'POST': if request.method == 'POST':
# csv_file = request.FILES['csv_file'] csv_file = request.FILES['csv_file']
# if not csv_file.name.endswith('.csv'): if not csv_file.name.endswith('.csv'):
# messages.error(request, 'This is not a CSV file') messages.error(request, 'This is not a CSV file')
# else: else:
# # read the data from the uploaded file # read the data from the uploaded file
# csv_data = csv.reader( csv_data = csv.reader(
# (line.decode('utf-8') for line in csv_file), (line.decode('utf-8') for line in csv_file),
# delimiter=',', delimiter=',',
# quotechar='"' quotechar='"'
# ) )
# #Loop through data rows #Loop through data rows
# for i, row in enumerate(csv_data): for i, row in enumerate(csv_data):
# # Check if this row is the start of a new report # Check if this row is the start of a new report
# if row[0] == 'PRODUCTIVITY REPORT': if row[0] == 'PRODUCTIVITY REPORT':
# # Reset variables for the new report # Reset variables for the new report
# sr_no = row[1] sr_no = row[1]
# employee_name= None employee_name= None
# prod_score = None prod_score = None
# date = None date = None
# totalworkhrs = None totalworkhrs = None
# # Check if this is the fifth row after the start of the report # Check if this is the fifth row after the start of the report
# elif i == 4 and employee_name is None: elif i == 4 and employee_name is None:
# employee_name = row[0] employee_name = row[0]
# # Check if this row contains a date and "Total Duration:" and "Productivity %" # Check if this row contains a date and "Total Duration:" and "Productivity %"
# if len(row) > 2 and "/" in row[0] and "Total Duration:" in row and "Productivity %" in row: if len(row) > 2 and "/" in row[0] and "Total Duration:" in row and "Productivity %" in row:
# date = datetime.strptime(row[0], '%m/%d/%Y').date() date = datetime.strptime(row[0], '%m/%d/%Y').date()
# totalworkhrs = timedelta(hours=float(row[row.index("Total Duration:") + 2])) totalworkhrs = timedelta(hours=float(row[row.index("Total Duration:") + 2]))
# prod_score = int(row[row.index("Productivity %") + 2]) prod_score = int(row[row.index("Productivity %") + 2])
# summary_pr = SummaryReport.objects.create(sr_no=sr_no, employee_name=employee_name, prod_score=prod_score, date=date, totalworkhrs=totalworkhrs) summary_pr = SummaryReport.objects.create(sr_no=sr_no, employee_name=employee_name, prod_score=prod_score, date=date, totalworkhrs=totalworkhrs)
# summary_pr.save() summary_pr.save()
# return redirect('home') return redirect('home')
# return render(request, 'EmployeeProdDB/upload_csv.html') return render(request, 'EmployeeProdDB/upload_csv.html')
def upload_csv(request): def upload_csv(request):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment