Refactor runBenchmark in SkillTreeViewModel for New Report Generation Flow

This commit updates the runBenchmark method in the SkillTreeViewModel class to align with the new report generation flow. The updated method does the following:

1. Checks if a benchmark is already running to prevent overlapping runs.
2. Sets a flag to indicate that the benchmark is running and notifies the UI.
3. Reverses the selected node hierarchy for report generation.
4. Loops through each node in the reversed hierarchy to:
  - Generate a unique UUID for each test run.
  - Create a ReportRequestBody object.
  - Call the generateSingleReport method in the BenchmarkService.
  - Update the UI after each single report is generated.

5. After all single reports are generated, it calls the generateCombinedReport method in the BenchmarkService, passing in all the generated UUIDs.

6. Finally, it sets the benchmark running flag to false and notifies the UI.

This change improves the report generation flow and allows for both individual and combined reports.
This commit is contained in:
hunteraraujo
2023-09-18 19:55:01 -07:00
parent 5814c5a365
commit bf03dd8739
2 changed files with 44 additions and 24 deletions

View File

@@ -56,15 +56,8 @@ class TaskQueueView extends StatelessWidget {
onPressed: viewModel.isBenchmarkRunning
? null
: () {
// Create a ReportRequestBody with hardcoded values
ReportRequestBody reportRequestBody = ReportRequestBody(
category: "",
tests: testNames,
mock: true,
);
// Call runBenchmark method from SkillTreeViewModel
viewModel.runBenchmark(reportRequestBody);
viewModel.runBenchmark();
},
child: Row(
mainAxisAlignment: