Class: WikidataPositionHistory::Check::Overlap

Inherits:
WikidataPositionHistory::Check show all
Defined in:
lib/wikidata_position_history/checks.rb

Overview

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

Instance Method Summary collapse

Methods inherited from WikidataPositionHistory::Check

#explanation, #initialize

Constructor Details

This class inherits a constructor from WikidataPositionHistory::Check

Instance Method Details

#headlineObject



166
167
168
# File 'lib/wikidata_position_history/checks.rb', line 166

def headline
  comparable? ? 'Date overlap' : 'Date precision'
end

#possible_explanationObject



170
171
172
173
# 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?Boolean

Returns:

  • (Boolean)


155
156
157
158
159
160
161
162
163
164
# 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