From 6cdf6220e49d5c2bb8e288271f828f07bf9a8431 Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Thu, 6 Jan 2022 16:25:58 +0100 Subject: [PATCH] wip #108 --- app/models/communication/website.rb | 4 ++-- app/models/university/person.rb | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/models/communication/website.rb b/app/models/communication/website.rb index 50cce129c..6749b6482 100644 --- a/app/models/communication/website.rb +++ b/app/models/communication/website.rb @@ -27,10 +27,10 @@ # fk_rails_... (university_id => universities.id) # class Communication::Website < ApplicationRecord - include WithGitRepository + include WithAbouts include WithGit + include WithGitRepository include WithHome - include WithAbouts include WithImport belongs_to :university diff --git a/app/models/university/person.rb b/app/models/university/person.rb index e5da3f416..68e34359f 100644 --- a/app/models/university/person.rb +++ b/app/models/university/person.rb @@ -100,7 +100,14 @@ class University::Person < ApplicationRecord end def identifiers(website: nil) - [:static, :author, :researcher, :teacher, :administrator] + website_id = website&.id + list = [] + list << :author if communication_websites.pluck(:id).include?(website_id) + list << :researcher if research_websites.pluck(:id).include?(website_id) + list << :teacher if education_websites.pluck(:id).include?(website_id) + # TODO :administrator + list << :static unless list.empty? + list end def git_path_static -- GitLab