Skip to content
Snippets Groups Projects
Commit 40a84c1d authored by Arnaud Levy's avatar Arnaud Levy
Browse files

year

parent e84f80b5
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,8 @@ class Extranet::AcademicYearsController < Extranet::ApplicationController
end
def show
@cohorts = @academic_year.cohorts_in_context(current_context.about)
@alumni = @academic_year.alumni_in_context(current_context.about)
breadcrumb
end
......
......@@ -29,12 +29,12 @@ class Education::AcademicYear < ApplicationRecord
def cohorts_in_context(context)
return cohorts if context.nil? || !context.respond_to?(:cohorts)
cohorts & context.cohorts
cohorts.where(id: context.cohorts.pluck(:id))
end
def alumni_in_context(context)
return alumni if context.nil? || !context.respond_to?(:alumni)
people & context.alumni
people.where(id: context.alumni.pluck(:id))
end
def to_s
......
......@@ -5,13 +5,13 @@
</header>
<h2 class="mb-4">
<%= @academic_year.cohorts.count %>
<%= Education::Cohort.model_name.human(count: @academic_year.cohorts.count).downcase %>
<%= @cohorts.count %>
<%= Education::Cohort.model_name.human(count: @cohorts.count).downcase %>
</h2>
<%= render 'extranet/cohorts/list', cohorts: @academic_year.cohorts %>
<%= render 'extranet/cohorts/list', cohorts: @cohorts %>
<h2 class="mt-5 mb-4">
<%= @academic_year.people.count %>
<%= University::Person::Alumnus.model_name.human(count: @academic_year.people.count).downcase %>
<%= @alumni.count %>
<%= University::Person::Alumnus.model_name.human(count: @alumni.count).downcase %>
</h2>
<%= render 'extranet/persons/list', people: @academic_year.people %>
<%= render 'extranet/persons/list', people: @alumni %>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment