Skip to content

Commit

Permalink
Fix only one ReconstructedSample appearing; both were created but wer…
Browse files Browse the repository at this point in the history
…e associated with the same particles object
  • Loading branch information
annehaley committed Sep 15, 2023
1 parent 3432b00 commit 279d235
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions shapeworks_cloud/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,16 +320,16 @@ def post_command_function(project, download_dir, result_data, project_filename):
project_data = json.load(pf)['data']
for i, sample in enumerate(project_data):
reconstructed_filenames = result_data['reconstructed_samples'][i]
particles = (
models.OptimizedParticles.objects.filter(project=project)
.filter(
subject_particles = list(
models.OptimizedParticles.objects.filter(project=project).filter(
Q(groomed_mesh__mesh__subject__name=sample['name'])
| Q(groomed_segmentation__segmentation__subject__name=sample['name'])
)
.first()
)
for reconstructed_filename in reconstructed_filenames:
reconstructed = models.ReconstructedSample(project=project, particles=particles)
for j, reconstructed_filename in enumerate(reconstructed_filenames):
reconstructed = models.ReconstructedSample(
project=project, particles=subject_particles[j]
)
reconstructed.file.save(
reconstructed_filename,
open(Path(download_dir, reconstructed_filename), 'rb'),
Expand Down

0 comments on commit 279d235

Please sign in to comment.