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
1485cb21
Commit
1485cb21
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
appointment list includes type and nd number
parent
75356830
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!130
Resolve "notification list changes"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/api_views/appointment.py
+16
-1
16 additions, 1 deletion
smash/web/api_views/appointment.py
smash/web/migrations/0105_unfinished_appointments_list_update.py
+17
-0
17 additions, 0 deletions
...eb/migrations/0105_unfinished_appointments_list_update.py
with
33 additions
and
1 deletion
smash/web/api_views/appointment.py
+
16
−
1
View file @
1485cb21
...
...
@@ -7,7 +7,7 @@ from django.utils import timezone
from
web.api_views.serialization_utils
import
serialize_datetime
,
location_to_str
,
flying_team_to_str
,
add_column
,
\
bool_to_yes_no
,
get_filters_for_data_table_request
from
web.models
import
Appointment
,
Study
,
SubjectColumns
,
AppointmentColumns
,
AppointmentList
from
web.models
import
Appointment
,
Study
,
SubjectColumns
,
AppointmentColumns
,
AppointmentList
,
StudyColumns
from
web.models.appointment_list
import
APPOINTMENT_LIST_GENERIC
,
APPOINTMENT_LIST_UNFINISHED
,
\
APPOINTMENT_LIST_APPROACHING
from
web.models.constants
import
GLOBAL_STUDY_ID
...
...
@@ -22,14 +22,18 @@ def get_appointment_columns(request, appointment_list_type):
if
len
(
appointment_lists
)
>
0
:
appointment_list
=
appointment_lists
[
0
]
subject_columns
=
appointment_list
.
visible_subject_columns
subject_study_columns
=
appointment_list
.
visible_study_subject_columns
appointment_columns
=
appointment_list
.
visible_appointment_columns
else
:
subject_columns
=
SubjectColumns
()
subject_study_columns
=
StudyColumns
()
appointment_columns
=
AppointmentColumns
()
result
=
[]
add_column
(
result
,
"
First name
"
,
"
first_name
"
,
subject_columns
,
"
string_filter
"
)
add_column
(
result
,
"
Last name
"
,
"
last_name
"
,
subject_columns
,
"
string_filter
"
)
add_column
(
result
,
"
ND number
"
,
"
nd_number
"
,
subject_study_columns
,
"
string_filter
"
)
add_column
(
result
,
"
Type
"
,
"
type
"
,
subject_study_columns
,
"
type_filter
"
)
add_column
(
result
,
"
Info sent
"
,
"
post_mail_sent
"
,
appointment_columns
,
"
yes_no_filter
"
)
add_column
(
result
,
"
Date
"
,
"
datetime_when
"
,
appointment_columns
,
None
)
add_column
(
result
,
"
Appointment types
"
,
"
appointment_types
"
,
appointment_columns
,
"
appointment_type_filter
"
,
...
...
@@ -73,6 +77,10 @@ def get_appointments_order(appointments_to_be_ordered, order_column, order_direc
result
=
appointments_to_be_ordered
.
order_by
(
order_direction
+
'
visit__subject__subject__first_name
'
)
elif
order_column
==
"
last_name
"
:
result
=
appointments_to_be_ordered
.
order_by
(
order_direction
+
'
visit__subject__subject__last_name
'
)
elif
order_column
==
"
nd_number
"
:
result
=
appointments_to_be_ordered
.
order_by
(
order_direction
+
'
visit__subject__nd_number
'
)
elif
order_column
==
"
type
"
:
result
=
appointments_to_be_ordered
.
order_by
(
order_direction
+
'
visit__subject__type
'
)
elif
order_column
==
"
location
"
:
result
=
appointments_to_be_ordered
.
order_by
(
order_direction
+
'
location
'
)
elif
order_column
==
"
flying_team
"
:
...
...
@@ -95,6 +103,10 @@ def get_appointments_filtered(appointments_to_be_filtered, filters):
result
=
result
.
filter
(
visit__subject__subject__first_name__icontains
=
value
)
elif
column
==
"
last_name
"
:
result
=
result
.
filter
(
visit__subject__subject__last_name__icontains
=
value
)
elif
column
==
"
nd_number
"
:
result
=
result
.
filter
(
visit__subject__nd_number__icontains
=
value
)
elif
column
==
"
type
"
:
result
=
result
.
filter
(
visit__subject__type
=
value
)
elif
column
==
"
location
"
:
result
=
result
.
filter
(
location
=
value
)
elif
column
==
"
flying_team
"
:
...
...
@@ -159,6 +171,7 @@ def serialize_appointment(appointment):
subject_string
=
""
first_name
=
""
last_name
=
""
subject_type
=
""
nd_number
=
screening_number
=
phone_numbers
=
appointment_type_names
=
None
if
appointment
.
visit
is
not
None
:
title
=
"
Visit
"
+
str
(
appointment
.
visit
.
visit_number
)
...
...
@@ -168,6 +181,7 @@ def serialize_appointment(appointment):
last_name
=
study_subject
.
subject
.
last_name
nd_number
=
study_subject
.
nd_number
screening_number
=
study_subject
.
screening_number
subject_type
=
study_subject
.
get_type_display
()
phone_numbers
=
"
,
"
.
join
(
filter
(
None
,
[
study_subject
.
subject
.
phone_number
,
study_subject
.
subject
.
phone_number_2
,
study_subject
.
subject
.
phone_number_3
]))
...
...
@@ -188,6 +202,7 @@ def serialize_appointment(appointment):
"
title
"
:
title
,
"
nd_number
"
:
nd_number
,
"
screening_number
"
:
screening_number
,
"
type
"
:
subject_type
,
"
phone_number
"
:
phone_numbers
,
"
appointment_type_names
"
:
appointment_type_names
,
"
datetime_until
"
:
until
,
...
...
This diff is collapsed.
Click to expand it.
smash/web/migrations/0105_unfinished_appointments_list_update.py
0 → 100644
+
17
−
0
View file @
1485cb21
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2018-02-14 10:26
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
web
'
,
'
0104_contact_required_list_update
'
),
]
operations
=
[
migrations
.
RunSQL
(
'
UPDATE web_studycolumns SET nd_number=TRUE, type=TRUE WHERE id IN
'
+
'
(SELECT visible_study_subject_columns_id FROM web_appointmentlist WHERE type =
\'
UNFINISHED
\'
);
'
),
]
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