From 4ce62653f71a696d1cdcf1d7a62439f9c92545ff Mon Sep 17 00:00:00 2001 From: Sebb Date: Fri, 15 Sep 2023 15:31:25 +0100 Subject: [PATCH] Show Petri inconsistencies --- lib/whimsy/asf/petri.rb | 18 +++++++++++++++--- www/roster/views/petri.html.rb | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/whimsy/asf/petri.rb b/lib/whimsy/asf/petri.rb index aa0c589ea6..39cb2d2458 100644 --- a/lib/whimsy/asf/petri.rb +++ b/lib/whimsy/asf/petri.rb @@ -22,6 +22,7 @@ class Petri attr_reader :wiki attr_reader :release attr_reader :licensing + attr_accessor :error def initialize(entry) key, hash = entry @@ -29,16 +30,27 @@ def initialize(entry) hash.each { |name, value| instance_variable_set("@#{name}", value) } end - # Array of all active Petri culture entries + # Array of all Petri culture entries def self.list @list = [] response = Net::HTTP.get_response(URI(PETRI_INFO)) response.value() # Raises error if not OK yaml = YAML.safe_load(response.body, permitted_classes: [Symbol]) # @mentors = yaml['mentors'] - # Active cultures are listed under projects + yaml['cultures'].each do |proj| + prj = new(proj) + if yaml['projects'].include? proj + prj.error = 'Listed as a current project' unless prj.status == 'current' + else + prj.error = 'Not listed as a current project' if prj.status == 'current' + end + @list << prj + end + # Now check against projects listing yaml['projects'].each do |proj| - @list << new(yaml['cultures'][proj]) + unless yaml['cultures'].include? proj + @list << new([proj,{name: '', status: '', error: 'No culture entry found'}]) + end end @list end diff --git a/www/roster/views/petri.html.rb b/www/roster/views/petri.html.rb index 463af8ec05..8d0c249526 100644 --- a/www/roster/views/petri.html.rb +++ b/www/roster/views/petri.html.rb @@ -32,6 +32,7 @@ _th.sorting_asc 'Id', data_sort: 'string-ins' _th 'Name', data_sort: 'string' _th 'Status', data_sort: 'string' + _th 'Error', data_sort: 'string' _th 'Description', data_sort: 'string' end end @@ -43,6 +44,7 @@ end _td petri.name _td petri.status + _td petri.error _td petri.description end end