class WikidataPositionHistory::Check::MissingFields
Does the Officeholder have all the properties we expect?
Public Instance Methods
expect_end_date?()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 74 def expect_end_date? later end
expect_next?()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 85 def expect_next? return unless later return if later.officeholder.id == current.officeholder.id # sucessive terms by same person !current.acting? end
expect_prev?()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 78 def expect_prev? return unless earlier return if earlier.officeholder.id == current.officeholder.id # sucessive terms by same person !current.acting? end
expect_start_date?()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 70 def expect_start_date? true end
expected()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 66 def expected field_map.keys.select { |field| send("expect_#{field}?") } end
field_map()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 57 def field_map { start_date: 580, prev: 1365, end_date: 582, next: 1366, } end
headline()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 45 def headline "Missing field#{missing.count > 1 ? 's' : ''}" end
missing()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 53 def missing expected.reject { |field| current.send(field) } end
possible_explanation()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 49 def possible_explanation "#{current.officeholder.qlink} is missing #{missing.map { |field| "{{P|#{field_map[field]}}}" }.join(', ')}" end
problem?()
click to toggle source
# File lib/wikidata_position_history/checks.rb, line 41 def problem? missing.any? end