Skip to content

Commit

Permalink
Use preferred grading model instead of having it as part of the grade…
Browse files Browse the repository at this point in the history
…s page dnna#22
  • Loading branch information
dnna authored and dspinellis committed Feb 26, 2016
1 parent bbbb6c2 commit 6412bc1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Pixelbonus/SiteBundle/Controller/QRController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public function course(Course $course) {
* @Secure(roles="ROLE_USER")
*/
public function courseGrades(Course $course) {
$user = $this->container->get('security.context')->getToken()->getUser();
// Get all tags
$tags = $this->container->get('doctrine')->getManager()->createQuery('SELECT t FROM Pixelbonus\SiteBundle\Entity\Tag t JOIN t.qrsets qrs WHERE qrs.course = :course')->setParameter('course', $course)->getResult();
$selectedTag = $this->getRequest()->get('tag');
Expand All @@ -58,7 +59,7 @@ public function courseGrades(Course $course) {
$maxRedemptions = 1;
}
// Add the grade based on our model
$selectedGradingModel = $this->getRequest()->get('model', 'reduction');
$selectedGradingModel = $this->getRequest()->get('model', $user->getPreferredGradingModel());
if($selectedGradingModel == 'reduction') {
$redemptions = array_map(function($e) use ($maxRedemptions) {
$e['grade'] = min($e['rcount']/$maxRedemptions*10, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
</ul>
</div>
</div>
<hr />
{#<hr />
<div class="row text-center">
<div class="col-lg-2">
{{'qr.grading_model'|trans}}:
</div>
<div class="col-lg-2"><a href="{{path('course_grades', app.request.get('_route_params')|merge(app.request.query.all())|merge({'course': course.id, 'model': 'reduction'}))}}" {% if selectedGradingModel == 'reduction' %}style="text-decoration: underline;"{% endif %}>{{'qr.reduction'|trans}}</a></div>
</div>
</div>#}
<hr />
<div class="row text-center">
<div class="col-lg-12">
Expand Down

0 comments on commit 6412bc1

Please sign in to comment.