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
19cbf788
Commit
19cbf788
authored
6 years ago
by
Carlos Vega
Browse files
Options
Downloads
Patches
Plain Diff
Fixes
#262
: sorting with empty screening number fails
parent
7536a235
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!181
Hotfix/import file
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
smash/web/models/study_subject.py
+20
-17
20 additions, 17 deletions
smash/web/models/study_subject.py
with
20 additions
and
17 deletions
smash/web/models/study_subject.py
+
20
−
17
View file @
19cbf788
...
...
@@ -179,23 +179,26 @@ class StudySubject(models.Model):
)
def
sort_matched_screening_first
(
self
,
pattern
,
reverse
=
False
):
parts
=
self
.
screening_number
.
split
(
'
;
'
)
matches
,
reminder
=
[],
[]
for
part
in
parts
:
chunks
=
part
.
strip
().
split
(
'
-
'
)
if
len
(
chunks
)
==
2
:
letter
,
number
=
chunks
tupl
=
(
letter
,
int
(
number
))
else
:
logger
.
warn
(
'
There are {} chunks in some parts of this screening_number: |{}|.
'
.
format
(
len
(
chunks
),
self
.
screening_number
))
tupl
=
(
part
.
strip
(),
None
)
if
pattern
is
not
None
and
pattern
in
part
:
matches
.
append
(
tupl
)
else
:
reminder
.
append
(
tupl
)
return
matches
+
sorted
(
reminder
,
reverse
=
reverse
)
if
self
.
screening_number
is
None
:
return
None
parts
=
self
.
screening_number
.
split
(
'
;
'
)
matches
,
reminder
=
[],
[]
for
part
in
parts
:
chunks
=
part
.
strip
().
split
(
'
-
'
)
if
len
(
chunks
)
==
2
:
letter
,
number
=
chunks
tupl
=
(
letter
,
int
(
number
))
else
:
logger
.
warn
(
'
There are {} chunks in some parts of this screening_number: |{}|.
'
.
format
(
len
(
chunks
),
self
.
screening_number
))
tupl
=
(
part
.
strip
(),
None
)
if
pattern
is
not
None
and
pattern
in
part
:
matches
.
append
(
tupl
)
else
:
reminder
.
append
(
tupl
)
return
matches
+
sorted
(
reminder
,
reverse
=
reverse
)
@staticmethod
def
check_nd_number_regex
(
regex_str
):
...
...
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