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
eedf9263
Commit
eedf9263
authored
4 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
added property to get provenances
parent
1fe34491
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!233
Feature/provenance
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
smash/web/models/study_subject.py
+5
-2
5 additions, 2 deletions
smash/web/models/study_subject.py
smash/web/models/subject.py
+4
-0
4 additions, 0 deletions
smash/web/models/subject.py
with
9 additions
and
2 deletions
smash/web/models/study_subject.py
+
5
−
2
View file @
eedf9263
...
...
@@ -3,19 +3,22 @@ import logging
import
re
from
django.db
import
models
from
web.models
import
VoucherType
,
Appointment
,
Location
,
Visit
from
web.models
import
VoucherType
,
Appointment
,
Location
,
Visit
,
Provenance
from
web.models.constants
import
BOOL_CHOICES
,
SUBJECT_TYPE_CHOICES
,
FILE_STORAGE
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
logger
=
logging
.
getLogger
(
__name__
)
class
StudySubject
(
models
.
Model
):
class
Meta
:
app_label
=
'
web
'
@property
def
provenances
(
self
):
return
Provenance
.
objects
.
filter
(
modified_table
=
StudySubject
.
_meta
.
db_table
).
filter
(
modified_table_id
=
self
.
id
).
order_by
(
'
-modification_date
'
)
def
finish_all_visits
(
self
):
visits
=
Visit
.
objects
.
filter
(
subject
=
self
,
is_finished
=
False
)
for
visit
in
visits
:
...
...
This diff is collapsed.
Click to expand it.
smash/web/models/subject.py
+
4
−
0
View file @
eedf9263
...
...
@@ -14,6 +14,10 @@ class Subject(models.Model):
class
Meta
:
app_label
=
'
web
'
@property
def
provenances
(
self
):
return
Provenance
.
objects
.
filter
(
modified_table
=
Subject
.
_meta
.
db_table
).
filter
(
modified_table_id
=
self
.
id
).
order_by
(
'
-modification_date
'
)
sex
=
models
.
CharField
(
max_length
=
1
,
choices
=
SEX_CHOICES
,
...
...
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