class Judges::Update
def summarize(fb, churn, errors, start, cycles)
-
cycles
(Integer
) -- How many cycles -
start
(Time
) -- When we started -
errors
(Array
) -- List of errors -
churn
(Churn
) -- The churn -
fb
(Factbase
) -- The factbase
def summarize(fb, churn, errors, start, cycles) before = fb.query('(eq what "judges-summary")').each.to_a if before.empty? s = fb.insert s.what = 'judges-summary' s.when = Time.now s.version = Judges::VERSION s.seconds = Time.now - start s.cycles = cycles s.inserted = churn.inserted.size s.deleted = churn.deleted.size s.added = churn.added.size else s = before.first errs = s['errors']&.size || 0 @loog.info( "A summary found, with #{errs.positive? || 'no'} error#{'s' if errs > 1 || errs.zero?}: " \ "#{%w[when cycles version inserted deleted added].map { |a| "#{a}=#{s[a]&.first}" }.join(', ')}" ) end if errors.empty? @loog.info('No errors added to the summary') else errors.each { |e| s.error = e } @loog.info("#{errors.size} error#{'s' if errors.size > 1} added to the summary") end end