return which files have been uploaded successfully
This commit is contained in:
+4
-3
@@ -49,12 +49,12 @@ def upload_dicom(request, files: List[UploadedFile] = File(...)):
|
|||||||
|
|
||||||
ud.save()
|
ud.save()
|
||||||
|
|
||||||
uploaded.append(ud)
|
uploaded.append((file.name, ud.image_md5_hash))
|
||||||
except DuplicateDicom:
|
except DuplicateDicom:
|
||||||
duplicate.append(ud)
|
duplicate.append((file.name, ud.image_md5_hash))
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return {"uploaded": len(uploaded), "duplicates": len(duplicate)}
|
return {"uploaded": uploaded, "duplicates": duplicate}
|
||||||
|
|
||||||
|
|
||||||
@router.get("/clear_dicoms", auth=django_auth)
|
@router.get("/clear_dicoms", auth=django_auth)
|
||||||
@@ -156,6 +156,7 @@ def series_remove_duplicate_images(request, series_id: int):
|
|||||||
|
|
||||||
@router.get("/get_cases_user", auth=django_auth, response=List[CaseSchema])
|
@router.get("/get_cases_user", auth=django_auth, response=List[CaseSchema])
|
||||||
def get_cases_user(request):
|
def get_cases_user(request):
|
||||||
|
print("HELLO")
|
||||||
return Case.objects.filter(author=request.user)
|
return Case.objects.filter(author=request.user)
|
||||||
|
|
||||||
@router.get("/check_image_hash/{hash}", auth=django_auth)
|
@router.get("/check_image_hash/{hash}", auth=django_auth)
|
||||||
|
|||||||
@@ -829,6 +829,9 @@ class UncategorisedDicom(models.Model):
|
|||||||
if UncategorisedDicom.objects.filter(image_md5_hash=image_hash):
|
if UncategorisedDicom.objects.filter(image_md5_hash=image_hash):
|
||||||
raise DuplicateDicom
|
raise DuplicateDicom
|
||||||
|
|
||||||
|
if SeriesImage.objects.filter(image_md5_hash=image_hash):
|
||||||
|
raise DuplicateDicom
|
||||||
|
|
||||||
# Hack for tests
|
# Hack for tests
|
||||||
if image_hash != "12345ABCD":
|
if image_hash != "12345ABCD":
|
||||||
super().save(*args, **kwargs) # Call the "real" save() method.
|
super().save(*args, **kwargs) # Call the "real" save() method.
|
||||||
|
|||||||
Reference in New Issue
Block a user