class WikidataPositionHistory::Check::Overlap

Does the end date overlap with the successor's start date?

Public Instance Methods

headline() click to toggle source
# File lib/wikidata_position_history/checks.rb, line 166
def headline
  comparable? ? 'Date overlap' : 'Date precision'
end
possible_explanation() click to toggle source
# File lib/wikidata_position_history/checks.rb, line 170
def possible_explanation
  format('%s has a {{P|582}} of %s, which %s the {{P|580}} of %s for %s',
         current.officeholder.qlink, current.end_date, overlap_explanation, later.start_date, later.officeholder.qlink)
end
problem?() click to toggle source
# File lib/wikidata_position_history/checks.rb, line 155
def problem?
  return false unless later

  next_starts = later.start_date or return false
  ends = current.end_date or return false

  ends > next_starts
rescue ArgumentError
  true
end

Protected Instance Methods

comparable?() click to toggle source
# File lib/wikidata_position_history/checks.rb, line 177
def comparable?
  # Seems like there must be a better way to do this
  [current.end_date, later.start_date].sort
rescue ArgumentError
  false
end
overlap_explanation() click to toggle source
# File lib/wikidata_position_history/checks.rb, line 184
def overlap_explanation
  comparable? ? 'is later than' : 'may overlap with'
end