fix school daily report task

pre_develop
p31729568 6 years ago
parent c389f0f2a6
commit da6cdb5f58

@ -41,11 +41,14 @@ class StatisticSchoolDailyReportTask
shixun_increase_count: shixun_count, active_user_count: active_user_count, date: current_date shixun_increase_count: shixun_count, active_user_count: active_user_count, date: current_date
} }
report = SchoolDailyReport.create!(create_params) report = SchoolDailyReport.create!(create_params)
if active_user_ids.present?
values = '(' + active_user_ids.join(", #{report.id}),(") + ", #{report.id})" values = '(' + active_user_ids.join(", #{report.id}),(") + ", #{report.id})"
user_sql = "INSERT INTO school_daily_active_users(user_id, school_daily_report_id) VALUES#{values}" user_sql = "INSERT INTO school_daily_active_users(user_id, school_daily_report_id) VALUES#{values}"
SchoolDailyActiveUser.connection.execute(user_sql) SchoolDailyActiveUser.connection.execute(user_sql)
end end
end end
end
private private
def current_date def current_date

Loading…
Cancel
Save