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
08ddf342
Commit
08ddf342
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
Property role of worker model. Check if the role is valid role.
#238
parent
574315a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!162
added role column to worker list. Issue #238
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/models/worker.py
+3
-1
3 additions, 1 deletion
smash/web/models/worker.py
with
3 additions
and
1 deletion
smash/web/models/worker.py
+
3
−
1
View file @
08ddf342
...
...
@@ -7,7 +7,7 @@ from django.db import models
from
web.models.constants
import
GLOBAL_STUDY_ID
,
COUNTRY_OTHER_ID
from
web.models.worker_study_role
import
STUDY_ROLE_CHOICES
,
HEALTH_PARTNER_ROLE_CHOICES
,
\
VOUCHER_PARTNER_ROLE_CHOICES
,
WORKER_STAFF
,
WORKER_HEALTH_PARTNER
,
WORKER_VOUCHER_PARTNER
VOUCHER_PARTNER_ROLE_CHOICES
,
WORKER_STAFF
,
WORKER_HEALTH_PARTNER
,
WORKER_VOUCHER_PARTNER
,
ROLE_CHOICES
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -167,6 +167,8 @@ class Worker(models.Model):
if
roles
.
count
()
==
0
:
return
WORKER_STAFF
role
=
roles
[
0
].
role
if
role
not
in
[
role_type
for
role_type
,
_
in
ROLE_CHOICES
]:
raise
TypeError
(
"
Unknown worker role
"
)
return
role
@staticmethod
...
...
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