Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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 JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chenhao Ma
core
Commits
12a871c3
Commit
12a871c3
authored
9 years ago
by
Kevin S. Hahn
Browse files
Options
Downloads
Patches
Plain Diff
tries to include age in search
parent
4048a302
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core.py
+11
-2
11 additions, 2 deletions
core.py
with
11 additions
and
2 deletions
core.py
+
11
−
2
View file @
12a871c3
...
...
@@ -436,18 +436,26 @@ class Core(base.RequestHandler):
session_query
=
{}
exam
=
json_body
.
get
(
'
exam
'
)
subj_code
=
json_body
.
get
(
'
subj_code
'
)
age_max
=
json_body
.
get
(
'
subj_age_max
'
)
age_min
=
json_body
.
get
(
'
subj_age_min
'
)
if
exam
:
session_query
.
update
({
'
exam
'
:
exam
})
if
subj_code
:
session_query
.
update
({
'
subject.code
'
:
subj_code
})
if
age_min
and
age_max
:
session_query
.
update
({
'
subject.age
'
:
{
'
$gte
'
:
age_min
,
'
$lte
'
:
age_max
}})
elif
age_max
:
session_query
.
update
({
'
subject.age
'
:
{
'
$lte
'
:
age_max
}})
elif
age_min
:
session_query
.
update
({
'
subject.age
'
:
{
'
$gte
'
:
age_min
}})
# TODO: don't build these, want to get as close to dump the data from the request
acq_query
=
{}
psd
=
json_body
.
get
(
'
psd
'
)
types_kind
=
json_body
.
get
(
'
scan_type
'
)
time_fmt
=
'
%Y-%m-%d
'
# assume that dates will come in as "2014-01-01"
date_to
=
json_body
.
get
(
'
date_to
'
)
# need to do some datetime conversion
description
=
json_body
.
get
(
'
description
'
)
date_to
=
json_body
.
get
(
'
date_to
'
)
# need to do some datetime conversion
if
date_to
:
date_to
=
datetime
.
datetime
.
strptime
(
date_to
,
time_fmt
)
date_from
=
json_body
.
get
(
'
date_from
'
)
# need to do some datetime conversion
...
...
@@ -463,9 +471,10 @@ class Core(base.RequestHandler):
acq_query
.
update
({
'
timestamp
'
:
{
'
$lte
'
:
date_to
}})
elif
date_from
:
acq_query
.
update
({
'
timestamp
'
:
{
'
$gte
'
:
date_from
}})
el
if
descrption
:
if
descr
i
ption
:
# glob style matching, whole word must exist within description
pass
# also query sessions
sessions
=
list
(
self
.
app
.
db
.
sessions
.
find
(
session_query
))
session_ids
=
[
s
[
'
_id
'
]
for
s
in
sessions
]
...
...
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