diff --git a/Kinza/lib/Kinza/Schema/Result/Presentation.pm b/Kinza/lib/Kinza/Schema/Result/Presentation.pm index d354c1a..2e7d923 100644 --- a/Kinza/lib/Kinza/Schema/Result/Presentation.pm +++ b/Kinza/lib/Kinza/Schema/Result/Presentation.pm @@ -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 { @@ -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; diff --git a/Kinza/views/courses.tt b/Kinza/views/courses.tt index ffa97d0..ae36b8c 100644 --- a/Kinza/views/courses.tt +++ b/Kinza/views/courses.tt @@ -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 -%] [% course_terms.join('
') %]