Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OSUG
JMMC
jmmc-jmdcui-docker
Commits
40b8bbc6
Commit
40b8bbc6
authored
Jan 23, 2020
by
Guillaume Mella
Browse files
handle duplicated entries
parent
5eeebb85
Changes
1
Hide whitespace changes
Inline
Side-by-side
jmdc-ui/jmdc_app/models/star_info.py
View file @
40b8bbc6
...
...
@@ -205,7 +205,11 @@ class StarInfo(Base):
#
def
is_unique
(
self
):
q
=
self
.
session
.
query
(
StarInfo
).
filter_by
(
id1
=
self
.
id1
,
id2
=
self
.
id2
,
ud_diam
=
self
.
ud_diam
,
ld_diam
=
self
.
ld_diam
,
e_ld_diam
=
self
.
e_ld_diam
).
count
()
# same id1, mesurements, bibcodes
q
=
self
.
session
.
query
(
StarInfo
).
filter_by
(
id1
=
self
.
id1
,
ud_diam
=
self
.
ud_diam
,
ld_diam
=
self
.
ld_diam
,
e_ld_diam
=
self
.
e_ld_diam
,
bibcode
=
self
.
bibcode
).
count
()
print
(
"is_unique query returns : %s"
%
q
)
if
q
>
0
:
self
.
append_entry_error
(
'star entry already present in the catalog (same id1, ud_diam, ld_diam and bibcode)'
)
return
not
q
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment