Skip to content

Commit

Permalink
Merge PR #151 by @isabelheisters
Browse files Browse the repository at this point in the history
* upstream/pr/151/head:
  Only the first institute is shown
  I changed the Exceptionhandling.  The Institutes Handling is working. The other one not, but I don't know why?
  changed the id
  Cchanged is_nil?  to nil?
  Fixed Problem and added Person ID
  fixed the typo
  Changed the problem
  So this is the Troubleshooting.. fixes #145

Signed-off-by: Torbjörn Klatt <[email protected]>
  • Loading branch information
torbjoernk committed Mar 18, 2016
2 parents dcb242b + 7733316 commit 4208105
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
4 changes: 2 additions & 2 deletions _data/people.yml
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,11 @@ kabadshow_i:
email: [email protected]
homepage: http://www.fz-juelich.de/SharedDocs/Personen/IAS/JSC/EN/staff/kabadshow_i.html

kalbarczyk,_z:
kalbarczyk_z:
sur_name: Kalbarczyk
given_name: Zbigniew
affiliation: uiuc
position:
position:
email: [email protected]
homepage: https://www.ece.illinois.edu/directory/profile/kalbarcz

Expand Down
21 changes: 20 additions & 1 deletion _plugins/statistics_tag.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

module JLESC
class StatisticsError < StandardError
def initialize(msg)
super(msg)
end
end

def self.get_stats(site)
institutes = site.data['institutes']
positions = site.data['positions']
Expand Down Expand Up @@ -42,12 +47,26 @@ def self.get_stats(site)

people.each do |id,person|
if person['affiliation'].is_a? Array
unless institutes.has_key?(person['affiliation'].first)
raise StatisticsError.new \
"Institute '#{person['affiliation'].first}' of person '#{id}' not found. Typo? See '_data/institutes.yml'."
end
statistics['institutes'][person['affiliation'].first]['people'] += 1
else
unless institutes.has_key?(person['affiliation'])
raise StatisticsError.new \
"Institute '#{person['affiliation']}' of person '#{id}' not found. Typo? See '_data/institutes.yml'."
end
statistics['institutes'][person['affiliation']]['people'] += 1
end

if statistics['people']['positions'].has_key?(person['position'])
unless person['position'].nil?
unless positions.has_key?(person['position'])
raise StatisticsError.new \
"Position '#{person['position']}' of person '#{id}' not found. Typo? See '_data/positions.yml'."
end
end
statistics['people']['positions'][person['position']] += 1
end

Expand Down

0 comments on commit 4208105

Please sign in to comment.