Skip to content

Conversation

@christianbeeznest
Copy link
Contributor

No description provided.

return $queryBuilder;
}

public function courseCodeExists(string $code): bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function doc comment

return (int) $qb->getSingleScalarResult() > 0;
}

public function findCourseAsArray($id)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing function doc comment

@qlty-cloud-legacy
Copy link

Code Climate has analyzed commit 576b2a4 and detected 69 issues on this pull request.

Here's the issue category breakdown:

Category Count
Style 51
Clarity 14
Complexity 2
Bug Risk 2

View more on Code Climate.

@chamilo chamilo deleted a comment from qlty-cloud-legacy bot Mar 27, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mejor moverlo a src/CoreBundle/ServiceHelper/EventLoggerHelper

public function addEvent(
string $eventType,
string $valueType,
$value,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El tipado podría ser mixed $value

Comment on lines +60 to +62
if (empty($params['title'])) {
throw new \InvalidArgumentException('The course title cannot be empty.');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto está validado en la misma entidad como Assert\NotBlank

} else {
console.error(tempResponse.message)
}
const response = await courseService.createCourse(formData)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este servicio que hace la llamada ajax a createCourse, tiene que ser a través de api-platform

}
} catch (\Exception $e) {

return new JsonResponse([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aquí se debería lanzar una exception en lugar de devolver una respuesta con json

}
}

public function sendEmailToAdmin(Course $course): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El correo debería enviarse en un EventListener después de crear el curso

$entityManager->flush();
}

private function insertCourseSettings(Course $course): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

También debería hacerse en un entity o event listener

return $gradebookCategory;
}

private function insertExampleContent(Course $course, GradebookCategory $gradebook): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este método podría ser un servicio a parte, como el de CreateDefaultPages

$this->createExampleGradebookContent($course, $gradebook, $exercise->id);
}

private function createExampleGradebookContent(Course $course, GradebookCategory $parentCategory, int $refId): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este método podría ser un servicio a parte, como el de CreateDefaultPages

#[Route('/create', name: 'chamilo_core_course_create')]
public function createCourse(Request $request, TranslatorInterface $translator): JsonResponse
{
public function createCourse(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debería estar en un StateProcessor de ApiPlatform para tener un solo endpoint de creación de curso

@christianbeeznest christianbeeznest merged commit dd6ecf8 into chamilo:master Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants