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
4e57c19e
Commit
4e57c19e
authored
6 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
list of exceeded visits doesn't include visits with ascheduled appointments
parent
0302719f
No related branches found
No related tags found
1 merge request
!152
Resolve "exceeded visit status"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/tests/view/test_notifications.py
+39
-0
39 additions, 0 deletions
smash/web/tests/view/test_notifications.py
smash/web/views/notifications.py
+3
-1
3 additions, 1 deletion
smash/web/views/notifications.py
with
42 additions
and
1 deletion
smash/web/tests/view/test_notifications.py
+
39
−
0
View file @
4e57c19e
...
...
@@ -183,6 +183,45 @@ class NotificationViewTests(LoggedInTestCase):
self
.
assertTrue
(
visits
[
0
].
datetime_begin
<
visits
[
1
].
datetime_begin
)
self
.
assertTrue
(
visits
[
1
].
datetime_begin
<
visits
[
2
].
datetime_begin
)
def
test_get_exceeded_visits
(
self
):
subject
=
create_study_subject
()
visit
=
create_visit
(
subject
)
visit
.
datetime_begin
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
12
)
visit
.
datetime_end
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
10
)
visit
.
visit_number
=
1
visit
.
is_finished
=
True
visit
.
save
()
visit
=
create_visit
(
subject
)
visit
.
datetime_begin
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
10
)
visit
.
datetime_end
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
8
)
visit
.
visit_number
=
2
visit
.
save
()
visits
=
get_exceeded_visits
(
self
.
user
)
self
.
assertEquals
(
1
,
visits
.
count
())
def
test_get_exceeded_visits_with_scheduled_appointment
(
self
):
subject
=
create_study_subject
()
visit
=
create_visit
(
subject
)
visit
.
datetime_begin
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
12
)
visit
.
datetime_end
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
10
)
visit
.
visit_number
=
1
visit
.
is_finished
=
True
visit
.
save
()
visit
=
create_visit
(
subject
)
visit
.
datetime_begin
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
10
)
visit
.
datetime_end
=
get_today_midnight_date
()
+
datetime
.
timedelta
(
days
=-
8
)
visit
.
visit_number
=
2
visit
.
save
()
create_appointment
(
visit
)
visits
=
get_exceeded_visits
(
self
.
user
)
self
.
assertEquals
(
0
,
visits
.
count
())
def
test_get_approaching_visits_without_appointments_count
(
self
):
original_notification
=
get_approaching_visits_without_appointments_count
(
self
.
user
)
subject
=
create_study_subject
()
...
...
This diff is collapsed.
Click to expand it.
smash/web/views/notifications.py
+
3
−
1
View file @
4e57c19e
...
...
@@ -244,7 +244,9 @@ def get_exceeded_visits(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
Q
(
visit_number__gt
=
1
)
|
Q
(
appointment__status
=
Appointment
.
APPOINTMENT_STATUS_FINISHED
)).
order_by
(
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
(
'
datetime_begin
'
)
...
...
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