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
94a1130b
Commit
94a1130b
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
consider excluded
parent
39bbc90d
No related branches found
No related tags found
1 merge request
!178
Feature/import data pdp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/views/notifications.py
+21
-13
21 additions, 13 deletions
smash/web/views/notifications.py
with
21 additions
and
13 deletions
smash/web/views/notifications.py
+
21
−
13
View file @
94a1130b
...
...
@@ -130,27 +130,35 @@ def get_notifications(the_user):
if
worker
is
not
None
:
study
=
Study
.
objects
.
filter
(
id
=
GLOBAL_STUDY_ID
)[
0
]
if
study
.
notification_parameters
.
exceeded_visits_visible
:
notifications
.
append
(
get_exceeded_visit_notifications_count
(
worker
))
notifications
.
append
(
get_exceeded_visit_notifications_count
(
worker
))
if
study
.
notification_parameters
.
unfinished_visits_visible
:
notifications
.
append
(
get_visits_without_appointments_count
(
worker
))
if
study
.
notification_parameters
.
approaching_visits_without_appointments_visible
:
notifications
.
append
(
get_approaching_visits_without_appointments_count
(
worker
))
notifications
.
append
(
get_approaching_visits_without_appointments_count
(
worker
))
if
study
.
notification_parameters
.
unfinished_appointments_visible
:
notifications
.
append
(
get_unfinished_appointments_count
(
worker
))
if
study
.
notification_parameters
.
visits_with_missing_appointments_visible
:
notifications
.
append
(
get_visits_with_missing_appointments_count
(
worker
))
notifications
.
append
(
get_visits_with_missing_appointments_count
(
worker
))
if
study
.
notification_parameters
.
subject_no_visits_visible
:
notifications
.
append
(
get_subject_with_no_visit_notifications_count
(
worker
))
notifications
.
append
(
get_subject_with_no_visit_notifications_count
(
worker
))
if
study
.
notification_parameters
.
subject_voucher_expiry_visible
:
notifications
.
append
(
get_subject_voucher_expiry_notifications_count
(
worker
))
notifications
.
append
(
get_subject_voucher_expiry_notifications_count
(
worker
))
if
study
.
notification_parameters
.
approaching_visits_for_mail_contact_visible
:
notifications
.
append
(
get_approaching_visits_for_mail_contact_count
(
worker
))
notifications
.
append
(
get_approaching_visits_for_mail_contact_count
(
worker
))
if
study
.
notification_parameters
.
subject_require_contact_visible
:
notifications
.
append
(
get_subjects_with_reminder_count
(
worker
))
if
study
.
notification_parameters
.
missing_redcap_subject_visible
:
notifications
.
append
(
get_missing_redcap_subject_notification_count
(
worker
))
notifications
.
append
(
get_missing_redcap_subject_notification_count
(
worker
))
if
study
.
notification_parameters
.
inconsistent_redcap_subject_visible
:
notifications
.
append
(
get_inconsistent_redcap_subject_notification_count
(
worker
))
notifications
.
append
(
get_inconsistent_redcap_subject_notification_count
(
worker
))
for
notification
in
notifications
:
count
+=
notification
.
count
...
...
@@ -164,7 +172,7 @@ def get_subjects_with_no_visit(user):
resigned
=
False
,
unfinished_visit_count
=
0
,
default_location__in
=
get_filter_locations
(
user
),
postponed
=
False
,
postponed
=
False
,
excluded
=
False
,
datetime_contact_reminder__isnull
=
True
,
).
exclude
(
vouchers__status
=
VOUCHER_STATUS_NEW
)
return
result
...
...
@@ -240,10 +248,12 @@ def get_approaching_visits_for_mail_contact(user):
def
get_exceeded_visits
(
user
):
return
Visit
.
objects
.
filter
(
datetime_end__lt
=
get_today_midnight_date
(),
is_finished
=
False
,
subject__default_location__in
=
get_filter_locations
(
user
)
subject__default_location__in
=
get_filter_locations
(
user
)
).
filter
(
# by default any visit where visit number is bigger than 1
# or in case of first visit - visits that had some successful appointment
# or in case of first visit - visits that had some successful
# appointment
Q
(
visit_number__gt
=
1
)
|
Q
(
appointment__status
=
Appointment
.
APPOINTMENT_STATUS_FINISHED
)).
filter
(
# visits that have scheduled appointments should be excluded
~
Q
(
appointment__status
=
Appointment
.
APPOINTMENT_STATUS_SCHEDULED
)).
order_by
(
...
...
@@ -325,5 +335,3 @@ def get_filter_locations(user):
return
Location
.
objects
.
all
()
else
:
return
worker
.
locations
.
all
()
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