feat(product-suite): confirm prior successful generations

This commit is contained in:
chengma
2026-07-17 10:47:44 +08:00
parent 9166cb7010
commit 9f55dcd4f0
8 changed files with 349 additions and 4 deletions
+51
View File
@@ -867,12 +867,48 @@ class ImageStudioTests(TempDirMixin, unittest.TestCase):
image_studio.ASSET_KIND_ORIGINAL,
path=db_path,
)
other_source = image_studio.add_asset(
other_project.id,
image_studio.ASSET_KIND_ORIGINAL,
path=db_path,
)
other_first = image_studio.create_job(
other_project.id,
source_asset_id=other_source.id,
task_key="other-first-generation-round",
generation_round_key="other-failed-round",
generation_slot_index=0,
path=db_path,
)
image_studio.update_job_status(
other_first.id,
"succeeded",
path=db_path,
)
other_failed = image_studio.create_job(
other_project.id,
source_asset_id=other_source.id,
task_key="other-failed-generation-round",
generation_round_key="other-failed-round",
generation_slot_index=0,
path=db_path,
)
image_studio.update_job_status(
other_failed.id,
"failed",
path=db_path,
)
legacy = image_studio.create_job(
project.id,
source_asset_id=source.id,
task_key="legacy-generation-round",
path=db_path,
)
legacy = image_studio.update_job_status(
legacy.id,
"succeeded",
path=db_path,
)
round_one = "round-one"
first = image_studio.create_job(
project.id,
@@ -1026,6 +1062,21 @@ class ImageStudioTests(TempDirMixin, unittest.TestCase):
self.assertEqual(1, summary.failed_count)
self.assertTrue(rounds[-1].is_legacy)
success_summary = image_studio.get_successful_generation_history_summary(
project.id,
path=db_path,
)
self.assertEqual(project.id, success_summary.project_id)
self.assertEqual(2, success_summary.successful_round_count)
self.assertEqual(3, success_summary.successful_image_count)
self.assertTrue(success_summary.latest_succeeded_at)
other_summary = image_studio.get_successful_generation_history_summary(
other_project.id,
path=db_path,
)
self.assertEqual(0, other_summary.successful_round_count)
self.assertEqual(0, other_summary.successful_image_count)
self.assert_removed(temp_dir)
def test_global_generation_rounds_filter_paginate_and_exclude_deleted_projects(self):