From 105b80101e35ab6a5beafcd2ef9dac19cbb95a3b Mon Sep 17 00:00:00 2001 From: hunteraraujo Date: Wed, 27 Sep 2023 15:33:11 -0700 Subject: [PATCH] Update Leaderboard Submission Dialog to Pass Parameters to ViewModel This commit updates the Leaderboard Submission Dialog to pass the team name, repository URL, and commit SHA as parameters to the submitToLeaderboard function in the SkillTreeViewModel. These changes ensure that the dialog and the ViewModel are aligned in terms of parameter requirements, facilitating efficient and accurate leaderboard submissions. --- .../lib/views/task_queue/leaderboard_submission_dialog.dart | 5 +++-- frontend/lib/views/task_queue/task_queue_view.dart | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/lib/views/task_queue/leaderboard_submission_dialog.dart b/frontend/lib/views/task_queue/leaderboard_submission_dialog.dart index 14c938db45d3..06f35e4d441d 100644 --- a/frontend/lib/views/task_queue/leaderboard_submission_dialog.dart +++ b/frontend/lib/views/task_queue/leaderboard_submission_dialog.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; class LeaderboardSubmissionDialog extends StatefulWidget { - final VoidCallback? onSubmit; + final Function(String, String, String)? onSubmit; const LeaderboardSubmissionDialog({ Key? key, @@ -73,7 +73,8 @@ class _LeaderboardSubmissionDialogState if (isValid) { _saveToSharedPreferences(); - widget.onSubmit?.call(); + widget.onSubmit?.call(_teamNameController.text, _repoUrlController.text, + _commitShaController.text); } else { setState(() {}); } diff --git a/frontend/lib/views/task_queue/task_queue_view.dart b/frontend/lib/views/task_queue/task_queue_view.dart index 94477bda3c49..3243eaea6d05 100644 --- a/frontend/lib/views/task_queue/task_queue_view.dart +++ b/frontend/lib/views/task_queue/task_queue_view.dart @@ -121,7 +121,10 @@ class TaskQueueView extends StatelessWidget { showDialog( context: context, builder: (context) => LeaderboardSubmissionDialog( - onSubmit: viewModel.submitToLeaderboard, + onSubmit: (teamName, repoUrl, commitSha) { + viewModel.submitToLeaderboard( + teamName, repoUrl, commitSha); + }, ), ); },