Skip to content

Commit

Permalink
setting paste_code file entry_point
Browse files Browse the repository at this point in the history
  • Loading branch information
as6325400 committed Sep 22, 2024
1 parent 12fe269 commit bb8e1e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 21 deletions.
3 changes: 1 addition & 2 deletions webapp/src/Controller/Team/SubmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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(),
Expand Down
20 changes: 1 addition & 19 deletions webapp/src/Form/Type/SubmitProblemPasteType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit bb8e1e5

Please sign in to comment.