nanterre: retourne le score pour chaque doublon (#19833)
This commit is contained in:
parent
3333e8e696
commit
89efde16c9
|
@ -25,6 +25,7 @@ def test_list_doublons(nanterre_classic_family, app):
|
|||
second_id = max(e['jean'].id, e['marie'].id)
|
||||
assert response.json['data'][0]['individu_1']['id'] == first_id
|
||||
assert response.json['data'][0]['individu_2']['id'] == second_id
|
||||
assert response.json['data'][0]['score'] == 100
|
||||
|
||||
new = []
|
||||
for i in range(100):
|
||||
|
@ -34,7 +35,7 @@ def test_list_doublons(nanterre_classic_family, app):
|
|||
Duplicate.objects.create(
|
||||
first=new[-1],
|
||||
second=e['marie'],
|
||||
score=1.0)
|
||||
score=(100-i/2)/100.0)
|
||||
|
||||
response = app.get(url)
|
||||
assert response.json['err'] == 0
|
||||
|
@ -47,6 +48,7 @@ def test_list_doublons(nanterre_classic_family, app):
|
|||
assert response.json['data'][0]['id'] == d.id
|
||||
assert response.json['data'][0]['individu_1']['id'] == first_id
|
||||
assert response.json['data'][0]['individu_2']['id'] == second_id
|
||||
assert response.json['data'][0]['score'] == 100
|
||||
first_data = response.json['data'][0]
|
||||
second_data = response.json['data'][1]
|
||||
|
||||
|
|
|
@ -1804,6 +1804,7 @@ class DoublonMixin(object):
|
|||
'created': duplicate.created.isoformat(),
|
||||
'state': duplicate.get_state_display(),
|
||||
'state_id': duplicate.state,
|
||||
'score': int(duplicate.score * 100),
|
||||
'individu_1': individu_to_response(duplicate.first, add_text=True),
|
||||
'individu_2': individu_to_response(duplicate.second, add_text=True),
|
||||
'content': duplicate.content,
|
||||
|
|
Loading…
Reference in New Issue