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
56d80e9a
Commit
56d80e9a
authored
5 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
added importer user to TnsCsvVisitImportReader
parent
517f27b5
No related branches found
No related tags found
1 merge request
!249
More provenance #328
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/importer/csv_tns_visit_import_reader.py
+11
-1
11 additions, 1 deletion
smash/web/importer/csv_tns_visit_import_reader.py
with
11 additions
and
1 deletion
smash/web/importer/csv_tns_visit_import_reader.py
+
11
−
1
View file @
56d80e9a
...
@@ -10,7 +10,7 @@ import pytz
...
@@ -10,7 +10,7 @@ import pytz
from
django.conf
import
settings
from
django.conf
import
settings
from
warning_counter
import
MsgCounterHandler
from
warning_counter
import
MsgCounterHandler
from
web.models
import
StudySubject
,
Study
,
Visit
,
Appointment
,
AppointmentType
,
Location
,
AppointmentTypeLink
,
Subject
from
web.models
import
StudySubject
,
Study
,
Visit
,
Appointment
,
AppointmentType
,
Location
,
AppointmentTypeLink
,
Subject
,
User
,
Worker
,
Provenance
from
web.models.constants
import
GLOBAL_STUDY_ID
from
web.models.constants
import
GLOBAL_STUDY_ID
CSV_DATE_FORMAT
=
"
%d/%m/%Y
"
CSV_DATE_FORMAT
=
"
%d/%m/%Y
"
...
@@ -33,6 +33,16 @@ class TnsCsvVisitImportReader:
...
@@ -33,6 +33,16 @@ class TnsCsvVisitImportReader:
self
.
processed_count
=
0
self
.
processed_count
=
0
self
.
warning_count
=
0
self
.
warning_count
=
0
self
.
importer_user
=
None
importer_user_name
=
getattr
(
settings
,
"
IMPORTER_USER
"
,
None
)
if
importer_user_name
is
not
None
:
user
=
User
.
objects
.
filter
(
username
=
importer_user_name
)
if
user
is
None
:
logger
.
warn
(
"
User does not exist:
"
+
importer_user_name
)
else
:
self
.
importer_user
=
Worker
.
objects
.
filter
(
user
=
user
)
def
load_data
(
self
,
filename
):
def
load_data
(
self
,
filename
):
warning_counter
=
MsgCounterHandler
()
warning_counter
=
MsgCounterHandler
()
logging
.
getLogger
(
''
).
addHandler
(
warning_counter
)
logging
.
getLogger
(
''
).
addHandler
(
warning_counter
)
...
...
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