app/concepts/statistic/daily_team_statistic_synchronizer.rb
# iterate evey uniq day of the statistics
iterate evey uniq day of the statistics
iterate evey uniq day of the statistics
def iterate_statistics_by_date statistics, props
    relevant_dates = statistics.pluck(:date).uniq
    delete_team_statistics_of_irrelevant_dates props, relevant_dates
    relevant_dates.map do |statistic_date|
      properties = props.merge(date: statistic_date)
      stats = statistics.where(properties)
      select_statistics_and_update_or_create_team_statistic stats, properties
    end
  end
def iterate_statistics_by_date statistics , props relevant_dates = statistics . pluck ( :date ) . uniq delete_team_statistics_of_irrelevant_dates props , relevant_dates relevant_dates . map do | statistic_date | properties = props . merge ( date : statistic_date ) stats = statistics . where ( properties ) select_statistics_and_update_or_create_team_statistic stats , properties end end
iterate evey uniq day of the statistics
iterate evey uniq day of the statistics
# delete all existing team-statistics of dates, that are no longer needed # then iterate the current dates to update/create the statistics
statistics
<not_specific>
props
<not_specific>