Skip to content
Snippets Groups Projects
Unverified Commit 1c312f70 authored by Nathaniel Kofalt's avatar Nathaniel Kofalt Committed by GitHub
Browse files

Merge pull request #1031 from scitran/correct-indentation

Correct indentation
parents 9979baa5 50ea692f
No related branches found
No related tags found
No related merge requests found
......@@ -23,57 +23,57 @@ SESSIONS = []
ACQUISITIONS = []
def handle_permissions(obj):
obj['permissions'] = [{
"access": "admin",
"_id": USER_ID
}]
obj['permissions'] = [{
"access": "admin",
"_id": USER_ID
}]
def handle_dates(obj):
if obj.get('timestamp'):
obj['timestamp'] = dateutil.parser.parse(obj['timestamp'])
if obj.get('created'):
obj['created'] = dateutil.parser.parse(obj['created'])
if obj.get('modified'):
obj['modified'] = dateutil.parser.parse(obj['modified'])
if obj.get('timestamp'):
obj['timestamp'] = dateutil.parser.parse(obj['timestamp'])
if obj.get('created'):
obj['created'] = dateutil.parser.parse(obj['created'])
if obj.get('modified'):
obj['modified'] = dateutil.parser.parse(obj['modified'])
def handle_file(f):
handle_dates(f)
f.pop('info_exists', None)
f.pop('join_origin', None)
f['hash'] = SAFE_FILE_HASH
handle_dates(f)
f.pop('info_exists', None)
f.pop('join_origin', None)
f['hash'] = SAFE_FILE_HASH
for i, s in enumerate(SESSIONS):
print "Processing session {} of {} sessions".format(i+1, len(SESSIONS))
print "Processing session {} of {} sessions".format(i+1, len(SESSIONS))
s.pop('join-origin', None)
s.pop('join-origin', None)
s['_id'] = bson.ObjectId(s['_id'])
s['project'] = bson.ObjectId(str(PROJECT_ID))
s['group'] = GROUP_ID
handle_dates(s)
handle_permissions(s)
s['_id'] = bson.ObjectId(s['_id'])
s['project'] = bson.ObjectId(str(PROJECT_ID))
s['group'] = GROUP_ID
handle_dates(s)
handle_permissions(s)
for f in s.get('files', []):
handle_file(f)
for f in s.get('files', []):
handle_file(f)
config.db.sessions.delete_many({'_id': s['_id']})
config.db.sessions.insert(s)
config.db.sessions.delete_many({'_id': s['_id']})
config.db.sessions.insert(s)
for i, a in enumerate(ACQUISITIONS):
print "Processing acquisition {} of {} acquisitions".format(i+1, len(ACQUISITIONS))
print "Processing acquisition {} of {} acquisitions".format(i+1, len(ACQUISITIONS))
a['_id'] = bson.ObjectId(a['_id'])
a['session'] = bson.ObjectId(a['session'])
a['_id'] = bson.ObjectId(a['_id'])
a['session'] = bson.ObjectId(a['session'])
a.pop('join-origin', None)
a.pop('join-origin', None)
handle_dates(a)
handle_permissions(a)
handle_dates(a)
handle_permissions(a)
for f in a.get('files', []):
handle_file(f)
for f in a.get('files', []):
handle_file(f)
config.db.acquisitions.delete_many({'_id': a['_id']})
config.db.acquisitions.insert(a)
config.db.acquisitions.delete_many({'_id': a['_id']})
config.db.acquisitions.insert(a)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment