Skip to content

Commit

Permalink
Fixed the 'courses' report.
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Sep 20, 2015
1 parent 1f31a65 commit 07ceb18
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Kinza/lib/Kinza/Schema/Result/Presentation.pm
Expand Up @@ -149,7 +149,7 @@ __PACKAGE__->many_to_many(
sub spaces {
my $self = shift;

return $self->course->capacity - $self->attendances->count;
return $self->course->capacity - $self->number;
}

sub available {
Expand All @@ -164,6 +164,11 @@ sub full {
return ! $self->available;
}

sub number {
my $self = shift;

return $self->attendances->count;
}

# You can replace this text with custom code or comments, and it will be preserved on regeneration
__PACKAGE__->meta->make_immutable;
Expand Down
2 changes: 1 addition & 1 deletion Kinza/views/courses.tt
Expand Up @@ -16,7 +16,7 @@
FOREACH term IN terms.all.sort('seq');
pres = course.in_term(term.id);
IF pres;
course_terms.push(term.name _ ' (' _ (pres.attendances.count || 0) _ ')');
course_terms.push(term.name _ ' (' _ (pres.number || 0) _ ')');
END;
END -%]
<td>[% course_terms.join('<br>') %]</td></tr>
Expand Down

0 comments on commit 07ceb18

Please sign in to comment.