This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ce62653 Show Petri inconsistencies
4ce62653 is described below

commit 4ce62653f71a696d1cdcf1d7a62439f9c92545ff
Author: Sebb <[email protected]>
AuthorDate: Fri Sep 15 15:31:25 2023 +0100

    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 aa0c589e..39cb2d24 100644
--- a/lib/whimsy/asf/petri.rb
+++ b/lib/whimsy/asf/petri.rb
@@ -22,6 +22,7 @@ module ASF
     attr_reader :wiki
     attr_reader :release
     attr_reader :licensing
+    attr_accessor :error
 
     def initialize(entry)
       key, hash = entry
@@ -29,16 +30,27 @@ module ASF
       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 463af8ec..8d0c2495 100644
--- a/www/roster/views/petri.html.rb
+++ b/www/roster/views/petri.html.rb
@@ -32,6 +32,7 @@ _html do
             _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 @@ _html do
               end
               _td petri.name
               _td petri.status
+              _td petri.error
               _td petri.description
             end
           end

Reply via email to