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
dd0a5200
Commit
dd0a5200
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
error fixed when saving and finishing appointment without visit
parent
9ff1a72c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!76
Resolve "sometimes saving daily planning doesn't work"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/tests/test_view_appointments.py
+19
-0
19 additions, 0 deletions
smash/web/tests/test_view_appointments.py
smash/web/views/appointment.py
+1
-1
1 addition, 1 deletion
smash/web/views/appointment.py
with
20 additions
and
1 deletion
smash/web/tests/test_view_appointments.py
+
19
−
0
View file @
dd0a5200
import
datetime
import
datetime
import
logging
from
django.urls
import
reverse
from
django.urls
import
reverse
...
@@ -9,6 +10,8 @@ from web.models import Appointment, Subject
...
@@ -9,6 +10,8 @@ from web.models import Appointment, Subject
from
web.views.notifications
import
get_today_midnight_date
from
web.views.notifications
import
get_today_midnight_date
from
.
import
LoggedInTestCase
from
.
import
LoggedInTestCase
logger
=
logging
.
getLogger
(
__name__
)
class
AppointmentsViewTests
(
LoggedInTestCase
):
class
AppointmentsViewTests
(
LoggedInTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -71,6 +74,22 @@ class AppointmentsViewTests(LoggedInTestCase):
...
@@ -71,6 +74,22 @@ class AppointmentsViewTests(LoggedInTestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_save_as_finished_appointments_edit_without_visit
(
self
):
appointment
=
create_appointment
(
None
,
get_today_midnight_date
())
appointment
.
visit
=
None
appointment
.
save
()
form_appointment
=
AppointmentEditForm
(
user
=
self
.
user
,
instance
=
appointment
,
prefix
=
"
appointment
"
)
form_data
=
{}
for
key
,
value
in
form_appointment
.
initial
.
items
():
if
value
is
not
None
:
form_data
[
'
appointment-{}
'
.
format
(
key
)]
=
format_form_field
(
value
)
form_data
[
'
appointment-status
'
.
format
(
key
)]
=
Appointment
.
APPOINTMENT_STATUS_FINISHED
self
.
client
.
post
(
reverse
(
'
web.views.appointment_edit
'
,
kwargs
=
{
'
id
'
:
appointment
.
id
}),
data
=
form_data
)
appointment_result
=
Appointment
.
objects
.
filter
(
id
=
appointment
.
id
)[
0
]
self
.
assertEqual
(
Appointment
.
APPOINTMENT_STATUS_FINISHED
,
appointment_result
.
status
)
def
test_save_appointments_edit
(
self
):
def
test_save_appointments_edit
(
self
):
subject
=
create_subject
()
subject
=
create_subject
()
visit
=
create_visit
(
subject
)
visit
=
create_visit
(
subject
)
...
...
This diff is collapsed.
Click to expand it.
smash/web/views/appointment.py
+
1
−
1
View file @
dd0a5200
...
@@ -80,7 +80,7 @@ def appointment_edit(request, id):
...
@@ -80,7 +80,7 @@ def appointment_edit(request, id):
subject_form
.
save
()
subject_form
.
save
()
the_appointment
=
get_object_or_404
(
Appointment
,
id
=
id
)
the_appointment
=
get_object_or_404
(
Appointment
,
id
=
id
)
if
the_appointment
.
status
==
Appointment
.
APPOINTMENT_STATUS_FINISHED
:
if
the_appointment
.
status
==
Appointment
.
APPOINTMENT_STATUS_FINISHED
and
the_appointment
.
visit
is
not
None
:
subject
=
Subject
.
objects
.
get
(
id
=
the_appointment
.
visit
.
subject
.
id
)
subject
=
Subject
.
objects
.
get
(
id
=
the_appointment
.
visit
.
subject
.
id
)
subject
.
information_sent
=
True
subject
.
information_sent
=
True
if
the_appointment
.
flying_team
is
not
None
and
subject
.
flying_team
is
None
:
if
the_appointment
.
flying_team
is
not
None
and
subject
.
flying_team
is
None
:
...
...
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