Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vytvor endpoint pre hodnotenia predmetov #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j-matus
Copy link

@j-matus j-matus commented Jun 30, 2020

Vytvor API endpoint, ktory vracia pre kazdy predmet za kazdy semester
jeho hodnotenie. Closes #256


This change is Reviewable

Vytvor API endpoint, ktory vracia pre kazdy predmet za kazdy semester
jeho hodnotenie. Closes fmfi-svt#256
@j-matus
Copy link
Author

j-matus commented Jun 30, 2020

Tento endpoint by mal vracat to co query v #256, mam ale este dve otazky:

  1. Metoda: Dovolujem prihlasenym pouzivatelom pristup aj cez GET, moze to takto ostat?
  2. Databaza: View AnswerSummary mal na Arene problem s pristupovymi pravami (nechcelo mi to dovolit citat ani ked som bol cez CLI prihlaseny ako root), priemery som nanovo pocital kvoli tomu. Ako su prava k AnswerSummary nastavene v produkcnej databaze?

Copy link
Member

@Adman Adman left a comment

Choose a reason for hiding this comment

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

@j-matus Vdaka za PR!

Doplnil som iba take malickosti.

Co sa tyka toho bodu 2, tak tam je pre databazu nastaveny specialny user.
Pokazene prava su asi iba na tvojej databaze. Ked pouzijem inu aa_<nieco>, tak viem selectovat z toho Viewu.

public function ratingsAction() {
$request = $this->get('request');
$user = $this->get('anketa.access.statistics')->getUser();
if ($request->getMethod() != 'POST' && $user === null) {
Copy link
Member

Choose a reason for hiding this comment

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

Tu dajme iba GET. POST nema zmysel, kedze neposielame ziadne data.

@@ -142,4 +142,21 @@ public function getMostRecentAverageEvaluations($subjectCodes) {
$query->execute($subjectCodes);
return $query->fetchAll(\PDO::FETCH_ASSOC);
}

public function getSubjectsRatings() {
$sql = 'SELECT code,name,slug,season_id,score '.
Copy link
Member

Choose a reason for hiding this comment

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

Iba nitpick - pridaj +2 medzery.

@@ -2,3 +2,7 @@ api_results:
pattern: /api/v1/results/
defaults: { _controller: AnketaBundle:Api:results, _format: json }
options: { i18n: false }
api_ratings:
pattern: /api/v1/ratings/
Copy link
Member

Choose a reason for hiding this comment

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

Tu by sme mohli vymazat to /api, kedze ten link je aktualne /api/api/...

@Adman
Copy link
Member

Adman commented Jul 1, 2020

@j-matus Vies to prosim este otestovat nejako, ci to vracia dobre vysledky?

@Adman
Copy link
Member

Adman commented Apr 2, 2021

@j-matus Ahoj, mas nejake novinky ohladom tohto?

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.

Vytvorit endpoint (API) na ziskanie celkoveho hodnotenia predmetov
2 participants