Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scheduling-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SMASCH
scheduling-system
Commits
832c2560
Commit
832c2560
authored
8 years ago
by
Jacek Lebioda
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of
https://git-r3lab.uni.lu/piotr.atyjaszyk/scheduling-system
parents
780fa5a5
c18500cb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smash/web/models.py
+11
-1
11 additions, 1 deletion
smash/web/models.py
smash/web/templates/assignments/index.html
+2
-2
2 additions, 2 deletions
smash/web/templates/assignments/index.html
smash/web/views.py
+25
-2
25 additions, 2 deletions
smash/web/views.py
with
38 additions
and
5 deletions
smash/web/models.py
+
11
−
1
View file @
832c2560
...
...
@@ -216,6 +216,16 @@ class AppointmentType (models.Model):
rest_time
=
models
.
IntegerField
(
verbose_name
=
'
Suggested rest time
'
)
REQ_ROLE_CHOICES
=
(
(
'
DOCTOR
'
,
'
Doctor
'
),
(
'
NURSE
'
,
'
Nurse
'
),
(
'
PSYCHOLOGIST
'
,
'
Psychologist
'
),
(
'
ANY
'
,
'
Any
'
)
)
required_worker
=
models
.
CharField
(
max_length
=
20
,
choices
=
REQ_ROLE_CHOICES
,
verbose_name
=
'
Type of worker required for assignment
'
,
default
=
'
ANY
'
)
def
__str__
(
self
):
return
self
.
apCode
...
...
@@ -363,7 +373,7 @@ class Appointment(models.Model):
)
datetime_when
=
models
.
DateTimeField
(
verbose_name
=
'
Appointment on
'
,
null
=
True
null
=
True
,
blank
=
True
)
length
=
models
.
IntegerField
(
verbose_name
=
'
Appointment length (in minutes)
'
...
...
This diff is collapsed.
Click to expand it.
smash/web/templates/assignments/index.html
+
2
−
2
View file @
832c2560
...
...
@@ -33,7 +33,7 @@
<th>
Subject name
</th>
<th>
Full information
</th>
<th>
Suggested date
</th>
<th>
Details
</th>
<th>
Plan/Modify
</th>
</tr>
</thead>
<tbody>
...
...
@@ -47,7 +47,7 @@
{{ planned.datetime_when }}
</td>
<td>
<button
type=
"button"
class=
"btn btn-block btn-default"
>
Details
</button>
<button
type=
"button"
class=
"btn btn-block btn-default"
>
Plan/Modify
</button>
</td>
</tr>
{% endfor %}
...
...
This diff is collapsed.
Click to expand it.
smash/web/views.py
+
25
−
2
View file @
832c2560
...
...
@@ -7,6 +7,7 @@ from .forms import *
from
.auth
import
*
# Own wrapper for django logging in/out
from
django.forms
import
modelformset_factory
from
django.shortcuts
import
render
from
django.db.models
import
Q
import
collections
import
datetime
...
...
@@ -228,9 +229,30 @@ def equipment_and_rooms(request):
def
mail_templates
(
request
):
return
wrap_response
(
request
,
"
mail_templates/index.html
"
,
{})
"""
#An initial draft of a function that was supposed to suggest date, room and worker for an assignment
def suggest_details(Appointment appoint):
avaibleWorkers = Worker.objects.get()
if appoint.appointment_type__required_worker ==
'
DOCTOR
'
:
avaibleWorkers.filter(role=
'
DOCTOR
'
)
elif appoint.appointment_type__required_worker ==
'
NURSE
'
:
avaibleWorkers.filter(role__in=[
'
DOCTOR
'
,
'
NURSE
'
])
elif appoint.appointment_type__required_worker ==
'
PSYCHOLOGIST
'
:
avaibleWorkers.filter(role__in=[
'
DOCTOR
'
,
'
PSYCHOLOGIST
'
])
avaibleRooms = Room.objects.get
requireditems = appoint.appointment_type.required_equipment.filter(is_fixed=True)
reduce(operator.and_, (Q(equipment__contains=requireditems) for x in avaibleRooms))
"""
def
assignments
(
request
):
planning_list
=
Appointment
.
objects
.
none
()
approaching_list
=
Appointment
.
objects
.
filter
(
datetime_when__gt
=
datetime
.
datetime
.
now
())
futureDate
=
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
days
=
93
)
planning_list
=
Appointment
.
objects
.
filter
(
datetime_when__isnull
=
True
,
visit__datetime_begin__lt
=
futureDate
)
approaching_list
=
Appointment
.
objects
.
filter
(
datetime_when__gt
=
datetime
.
datetime
.
now
())
context
=
{
'
planning_list
'
:
planning_list
,
...
...
@@ -247,6 +269,7 @@ def assignment_details(request, id):
def
assignment_add
(
request
,
id
):
if
request
.
method
==
'
POST
'
:
form
=
AppointmentAddForm
(
request
.
POST
,
request
.
FILES
)
form
.
fields
[
'
visit
'
].
widget
=
forms
.
HiddenInput
()
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
visit_details
,
id
=
id
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment