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
8ab77aea
Commit
8ab77aea
authored
7 years ago
by
Piotr Gawron
Browse files
Options
Downloads
Patches
Plain Diff
subject list with no visits/contact required added to be handled
dynamically
parent
70690a3b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!34
Performance of subject list
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/api_views.py
+6
-1
6 additions, 1 deletion
smash/web/api_views.py
smash/web/views/subject.py
+4
-9
4 additions, 9 deletions
smash/web/views/subject.py
with
10 additions
and
10 deletions
smash/web/api_views.py
+
6
−
1
View file @
8ab77aea
...
@@ -4,7 +4,8 @@ from django.contrib.auth.decorators import login_required
...
@@ -4,7 +4,8 @@ from django.contrib.auth.decorators import login_required
from
django.http
import
JsonResponse
from
django.http
import
JsonResponse
from
models
import
Subject
,
Worker
,
AppointmentType
,
Location
from
models
import
Subject
,
Worker
,
AppointmentType
,
Location
from
views.subject
import
SUBJECT_LIST_GENERIC
from
views.subject
import
SUBJECT_LIST_GENERIC
,
SUBJECT_LIST_NO_VISIT
,
SUBJECT_LIST_REQUIRE_CONTACT
from
views.notifications
import
get_subjects_with_no_visit
,
get_subjects_with_reminder
@login_required
@login_required
...
@@ -62,6 +63,10 @@ def units(request):
...
@@ -62,6 +63,10 @@ def units(request):
def
get_subjects
(
request
,
type
):
def
get_subjects
(
request
,
type
):
if
type
==
SUBJECT_LIST_GENERIC
:
if
type
==
SUBJECT_LIST_GENERIC
:
return
Subject
.
objects
.
all
()
return
Subject
.
objects
.
all
()
elif
type
==
SUBJECT_LIST_NO_VISIT
:
return
get_subjects_with_no_visit
(
request
.
user
)
elif
type
==
SUBJECT_LIST_REQUIRE_CONTACT
:
return
get_subjects_with_reminder
(
request
.
user
)
else
:
else
:
raise
TypeError
(
"
Unknown query type:
"
+
type
)
raise
TypeError
(
"
Unknown query type:
"
+
type
)
...
...
This diff is collapsed.
Click to expand it.
smash/web/views/subject.py
+
4
−
9
View file @
8ab77aea
...
@@ -8,14 +8,13 @@ from ..forms import SubjectAddForm, SubjectEditForm, VisitDetailForm, get_prefix
...
@@ -8,14 +8,13 @@ from ..forms import SubjectAddForm, SubjectEditForm, VisitDetailForm, get_prefix
from
..models
import
Subject
,
Worker
from
..models
import
Subject
,
Worker
SUBJECT_LIST_GENERIC
=
"
GENERIC
"
SUBJECT_LIST_GENERIC
=
"
GENERIC
"
SUBJECT_LIST_NO_VISIT
=
"
NO_VISIT
"
SUBJECT_LIST_REQUIRE_CONTACT
=
"
REQUIRE_CONTACT
"
def
subjects
(
request
):
def
subjects
(
request
):
subjects_list
=
Subject
.
objects
.
order_by
(
'
-last_name
'
)
context
=
{
context
=
{
'
subjects_list
'
:
subjects_list
,
'
list_type
'
:
SUBJECT_LIST_GENERIC
,
'
list_type
'
:
SUBJECT_LIST_GENERIC
,
}
}
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
...
@@ -33,20 +32,16 @@ def subject_add(request):
...
@@ -33,20 +32,16 @@ def subject_add(request):
def
subject_no_visits
(
request
):
def
subject_no_visits
(
request
):
subjects_list
=
get_subjects_with_no_visit
(
request
.
user
).
order_by
(
'
-last_name
'
)
context
=
{
context
=
{
'
subjects_list
'
:
subjects_list
'
list_type
'
:
SUBJECT_LIST_NO_VISIT
,
}
}
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
def
subject_require_contact
(
request
):
def
subject_require_contact
(
request
):
subjects_list
=
get_subjects_with_reminder
(
request
.
user
).
order_by
(
'
-last_name
'
)
context
=
{
context
=
{
'
subjects_list
'
:
subjects_list
'
list_type
'
:
SUBJECT_LIST_REQUIRE_CONTACT
,
}
}
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
return
wrap_response
(
request
,
'
subjects/index.html
'
,
context
)
...
...
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