Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
JARVIS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacob Dylan D. Vitug
JARVIS
Commits
394320e2
Commit
394320e2
authored
Apr 04, 2023
by
DwyxE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
error again i give up !
parent
72d2568a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
51 additions
and
2 deletions
+51
-2
models.cpython-39.pyc
IPS/IPSapp/__pycache__/models.cpython-39.pyc
+0
-0
views.cpython-39.pyc
IPS/IPSapp/__pycache__/views.cpython-39.pyc
+0
-0
0001_initial.py
IPS/IPSapp/migrations/0001_initial.py
+2
-2
0001_initial.cpython-39.pyc
...IPSapp/migrations/__pycache__/0001_initial.cpython-39.pyc
+0
-0
0002_remove_summaryreport_id_summaryreport_sr_no.cpython-39.pyc
...emove_summaryreport_id_summaryreport_sr_no.cpython-39.pyc
+0
-0
0003_alter_summaryreport_sr_no.cpython-39.pyc
...__pycache__/0003_alter_summaryreport_sr_no.cpython-39.pyc
+0
-0
models.py
IPS/IPSapp/models.py
+2
-0
show_csv_data2.html
IPS/IPSapp/templates/EmployeeProdDB/show_csv_data2.html
+4
-0
views.py
IPS/IPSapp/views.py
+43
-0
No files found.
IPS/IPSapp/__pycache__/models.cpython-39.pyc
View file @
394320e2
No preview for this file type
IPS/IPSapp/__pycache__/views.cpython-39.pyc
View file @
394320e2
No preview for this file type
IPS/IPSapp/migrations/0001_initial.py
View file @
394320e2
# Generated by Django 4.2 on 2023-04-04
09:3
4
# Generated by Django 4.2 on 2023-04-04
10:2
4
from
django.db
import
migrations
,
models
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
django.db.models.deletion
...
@@ -50,7 +50,7 @@ class Migration(migrations.Migration):
...
@@ -50,7 +50,7 @@ class Migration(migrations.Migration):
migrations
.
CreateModel
(
migrations
.
CreateModel
(
name
=
'SummaryReport'
,
name
=
'SummaryReport'
,
fields
=
[
fields
=
[
(
'
id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'
sr_no'
,
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
)),
(
'prod_score'
,
models
.
IntegerField
()),
(
'prod_score'
,
models
.
IntegerField
()),
(
'date'
,
models
.
DateField
()),
(
'date'
,
models
.
DateField
()),
(
'totalworkhrs'
,
models
.
DurationField
()),
(
'totalworkhrs'
,
models
.
DurationField
()),
...
...
IPS/IPSapp/migrations/__pycache__/0001_initial.cpython-39.pyc
View file @
394320e2
No preview for this file type
IPS/IPSapp/migrations/__pycache__/0002_remove_summaryreport_id_summaryreport_sr_no.cpython-39.pyc
0 → 100644
View file @
394320e2
File added
IPS/IPSapp/migrations/__pycache__/0003_alter_summaryreport_sr_no.cpython-39.pyc
0 → 100644
View file @
394320e2
File added
IPS/IPSapp/models.py
View file @
394320e2
...
@@ -93,6 +93,8 @@ class History(models.Model):
...
@@ -93,6 +93,8 @@ class History(models.Model):
# totalworkhrs = models.DurationField()
# totalworkhrs = models.DurationField()
class
SummaryReport
(
models
.
Model
):
class
SummaryReport
(
models
.
Model
):
sr_no
=
models
.
AutoField
(
primary_key
=
True
)
employee_name
=
models
.
CharField
(
max_length
=
255
)
prod_score
=
models
.
IntegerField
()
prod_score
=
models
.
IntegerField
()
date
=
models
.
DateField
()
date
=
models
.
DateField
()
totalworkhrs
=
models
.
DurationField
()
totalworkhrs
=
models
.
DurationField
()
...
...
IPS/IPSapp/templates/EmployeeProdDB/show_csv_data2.html
View file @
394320e2
<table>
<table>
<thead>
<thead>
<tr>
<tr>
<th>
SR No
</th>
<th>
Employee Name
</th>
<th>
Date
</th>
<th>
Date
</th>
<th>
Prod Score
</th>
<th>
Prod Score
</th>
<th>
Total Work Hrs
</th>
<th>
Total Work Hrs
</th>
...
@@ -10,6 +12,8 @@
...
@@ -10,6 +12,8 @@
<tbody>
<tbody>
{% for row in csv_data %}
{% for row in csv_data %}
<tr>
<tr>
<td>
{{ row.sr_no}}
</td>
<td>
{{ row.employee_name}}
</td>
<td>
{{ row.date}}
</td>
<td>
{{ row.date}}
</td>
<td>
{{ row.productivity_score }}
</td>
<td>
{{ row.productivity_score }}
</td>
<td>
{{ row.totalworkhrs }}
</td>
<td>
{{ row.totalworkhrs }}
</td>
...
...
IPS/IPSapp/views.py
View file @
394320e2
...
@@ -64,6 +64,49 @@ def loginpage(request):
...
@@ -64,6 +64,49 @@ def loginpage(request):
else
:
else
:
return
render
(
request
,
'EmployeeProdDB/loginpage.html'
)
return
render
(
request
,
'EmployeeProdDB/loginpage.html'
)
def
upload_csv
(
request
):
if
request
.
method
==
'POST'
:
csv_file
=
request
.
FILES
[
'csv_file'
]
if
not
csv_file
.
name
.
endswith
(
'.csv'
):
messages
.
error
(
request
,
'This is not a CSV file'
)
else
:
# read the data from the uploaded file
csv_data
=
csv
.
reader
(
(
line
.
decode
(
'utf-8'
)
for
line
in
csv_file
),
delimiter
=
','
,
quotechar
=
'"'
)
#Loop through data rows
for
i
,
row
in
enumerate
(
csv_data
):
# Check if this row is the start of a new report
if
row
[
0
]
==
'PRODUCTIVITY REPORT'
:
# Reset variables for the new report
sr_no
=
row
[
1
]
employee_name
=
None
prod_score
=
None
date
=
None
totalworkhrs
=
None
# Check if this is the fifth row after the start of the report
elif
i
==
4
and
employee_name
is
None
:
employee_name
=
row
[
0
]
# 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
:
date
=
datetime
.
strptime
(
row
[
0
],
'
%
m/
%
d/
%
Y'
)
.
date
()
totalworkhrs
=
timedelta
(
hours
=
float
(
row
[
row
.
index
(
"Total Duration:"
)
+
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
.
save
()
return
redirect
(
'home'
)
return
render
(
request
,
'EmployeeProdDB/upload_csv.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'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment