Skip to content

Commit 42e4a26

Browse files
committed
setting paste_code file entry_point
1 parent 9c8549e commit 42e4a26

File tree

2 files changed

+2
-21
lines changed

2 files changed

+2
-21
lines changed

webapp/src/Controller/Team/SubmissionController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public function createAction(Request $request, ?Problem $problem = null): Respon
7373

7474
$formUpload->handleRequest($request);
7575
$formPaste->handleRequest($request);
76-
7776
if ($formUpload->isSubmitted() && $formUpload->isValid()) {
7877
if ($contest === null) {
7978
$this->addFlash('danger', 'No active contest');
@@ -150,7 +149,7 @@ public function createAction(Request $request, ?Problem $problem = null): Respon
150149
);
151150

152151
$files = [$uploadedFile];
153-
$entryPoint = $formPaste->get('entry_point')->getData() ?: null;
152+
$entryPoint = $tempFileName;
154153
$submission = $this->submissionService->submitSolution(
155154
$team,
156155
$this->dj->getUser(),

webapp/src/Form/Type/SubmitProblemPasteType.php

+1-19
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
6868
'label' => 'Entry point',
6969
'required' => false,
7070
'help' => 'The entry point for your code.',
71-
'row_attr' => ['data-entry-point' => ''],
72-
'constraints' => [
73-
new Callback(function ($value, ExecutionContextInterface $context) {
74-
/** @var Form $form */
75-
$form = $context->getRoot();
76-
/** @var Language $language */
77-
$language = $form->get('language')->getData();
78-
if ($language && $language->getRequireEntryPoint() && empty($value)) {
79-
$message = sprintf(
80-
'%s required, but not specified',
81-
$language->getEntryPointDescription() ?: 'Entry point'
82-
);
83-
$context
84-
->buildViolation($message)
85-
->atPath('entry_point')
86-
->addViolation();
87-
}
88-
}),
89-
]
71+
'row_attr' => ['data-entry-point' => '']
9072
]);
9173
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($problemConfig) {
9274
$data = $event->getData();

0 commit comments

Comments
 (0)