app/models/athlete.rb
Complex method Athlete#award_by_five_plus_badge? (40.5) Open
Open
def award_by_five_plus_badge?
initial_date = Date.current.saturday? ? Date.current : Date.tomorrow.prev_week(:saturday)
Activity
.where(id: results.select(:activity_id))
.or(Activity.where(id: Volunteer.where(athlete: self).select(:activity_id)))
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool
Complex method Athlete::duplicates (25.4) Open
Open
def self.duplicates
sql = <<~SQL.squish
SELECT id, parkrun_code, fiveverst_code, l_name FROM (
SELECT id, parkrun_code, fiveverst_code, l_name, COUNT(id) OVER (PARTITION BY l_name) AS cnt FROM (
SELECT *, array(SELECT unnest(string_to_array(LOWER(name), ' ')) ORDER BY 1) AS l_name FROM athletes
- Read upRead up
- Exclude checks
Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.
You can read more about ABC metrics or the flog tool