From bb8e1e5133e34f8ce3523c9c67a3af40d0adff37 Mon Sep 17 00:00:00 2001 From: as6325400 Date: Sun, 22 Sep 2024 19:10:15 +0800 Subject: [PATCH] setting paste_code file entry_point --- .../Controller/Team/SubmissionController.php | 3 +-- .../src/Form/Type/SubmitProblemPasteType.php | 20 +------------------ 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/webapp/src/Controller/Team/SubmissionController.php b/webapp/src/Controller/Team/SubmissionController.php index 7cd4d8e902..d5d9eb3d06 100644 --- a/webapp/src/Controller/Team/SubmissionController.php +++ b/webapp/src/Controller/Team/SubmissionController.php @@ -67,7 +67,6 @@ public function createAction(Request $request, ?Problem $problem = null): Respon $formUpload->handleRequest($request); $formPaste->handleRequest($request); - if ($formUpload->isSubmitted() && $formUpload->isValid()) { if ($contest === null) { $this->addFlash('danger', 'No active contest'); @@ -144,7 +143,7 @@ public function createAction(Request $request, ?Problem $problem = null): Respon ); $files = [$uploadedFile]; - $entryPoint = $formPaste->get('entry_point')->getData() ?: null; + $entryPoint = $tempFileName; $submission = $this->submissionService->submitSolution( $team, $this->dj->getUser(), diff --git a/webapp/src/Form/Type/SubmitProblemPasteType.php b/webapp/src/Form/Type/SubmitProblemPasteType.php index b0ee0f2f18..71050b95a8 100644 --- a/webapp/src/Form/Type/SubmitProblemPasteType.php +++ b/webapp/src/Form/Type/SubmitProblemPasteType.php @@ -68,25 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'Entry point', 'required' => false, 'help' => 'The entry point for your code.', - 'row_attr' => ['data-entry-point' => ''], - 'constraints' => [ - new Callback(function ($value, ExecutionContextInterface $context) { - /** @var Form $form */ - $form = $context->getRoot(); - /** @var Language $language */ - $language = $form->get('language')->getData(); - if ($language && $language->getRequireEntryPoint() && empty($value)) { - $message = sprintf( - '%s required, but not specified', - $language->getEntryPointDescription() ?: 'Entry point' - ); - $context - ->buildViolation($message) - ->atPath('entry_point') - ->addViolation(); - } - }), - ] + 'row_attr' => ['data-entry-point' => ''] ]); $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($problemConfig) { $data = $event->getData();