You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@whimsical.apache.org by se...@apache.org on 2021/07/31 13:57:51 UTC

[whimsy] branch master updated: Try to find duplicate ICLAs

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 0e90590  Try to find duplicate ICLAs
0e90590 is described below

commit 0e90590b9a834b545b2f6be240fb4f899cff20a5
Author: Sebb <se...@apache.org>
AuthorDate: Sat Jul 31 14:57:42 2021 +0100

    Try to find duplicate ICLAs
---
 www/secretary/icla-dupes.cgi | 87 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/www/secretary/icla-dupes.cgi b/www/secretary/icla-dupes.cgi
new file mode 100755
index 0000000..9dd8120
--- /dev/null
+++ b/www/secretary/icla-dupes.cgi
@@ -0,0 +1,87 @@
+#!/usr/bin/env ruby
+
+# script to try and find duplicate ICLAs from the same people
+
+$LOAD_PATH.unshift '/srv/whimsy/lib'
+
+require 'wunderbar/script'
+require 'ruby2js/filter/functions'
+require 'whimsy/asf'
+
+_html do
+  _style %{
+    table {border-collapse: collapse}
+    table, th, td {border: 1px solid black}
+    td {padding: 3px 6px}
+    tr:hover td {background-color: #FF8}
+    th {background-color: #a0ddf0}
+  }
+
+  _h1 'ICLA duplicates check'
+
+  _p do
+    _ 'This script checks for possible duplicate ICLAs.'
+    _ 'It does this by splitting the Full Names into separate words, sorting them and then looking for duplicates.'
+  end
+
+  _p 'Further checks TBA, e.g. looking for partial matches'
+
+  dups = Hash.new{|h,k| h[k]=Array.new}
+  ASF::ICLA.each do |icla|
+    legal=icla.legal_name
+    key = legal.split(' ').sort.join(' ')
+    dups[key] << {legal: legal, email: icla.email, claRef: icla.claRef, id: icla.id}
+  end
+
+  _table do
+    _tr do
+      _th 'Key'
+      _th 'Id'
+      _th 'Legal Name'
+      _th 'Email'
+      _th 'CLAref'
+    end
+    dups.sort_by{|k,v| k}.each do |key, val|
+      if val.size > 1
+        _tr do
+          _td key
+          _td do
+            val.each do |v|
+              id = v[:id]
+              if id == 'notinavail'
+                _ id
+              else
+                _a id, href: '/roster/committer/' + id
+              end
+              _br
+            end
+          end
+          _td do
+            val.each do |v|
+              _ v[:legal]
+              _br
+            end
+          end
+          _td do
+            val.each do |v|
+              _ v[:email]
+              _br
+            end
+          end
+          _td do
+            val.each do |v|
+              claRef = v[:claRef]
+              file = ASF::ICLAFiles.match_claRef(claRef)
+              if file
+                _a claRef, href: ASF::SVN.svnpath!('iclas', file)
+              else
+                _ claRef
+              end
+              _br
+            end
+          end
+        end
+      end
+    end  
+  end
+end