Skip to content

Commit bb8e1e5

Browse files
committed
setting paste_code file entry_point
1 parent 12fe269 commit bb8e1e5

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
@@ -67,7 +67,6 @@ public function createAction(Request $request, ?Problem $problem = null): Respon
6767

6868
$formUpload->handleRequest($request);
6969
$formPaste->handleRequest($request);
70-
7170
if ($formUpload->isSubmitted() && $formUpload->isValid()) {
7271
if ($contest === null) {
7372
$this->addFlash('danger', 'No active contest');
@@ -144,7 +143,7 @@ public function createAction(Request $request, ?Problem $problem = null): Respon
144143
);
145144

146145
$files = [$uploadedFile];
147-
$entryPoint = $formPaste->get('entry_point')->getData() ?: null;
146+
$entryPoint = $tempFileName;
148147
$submission = $this->submissionService->submitSolution(
149148
$team,
150149
$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)