fix school daily report task

pre_develop
p31729568 6 years ago
parent c389f0f2a6
commit da6cdb5f58

@ -41,9 +41,12 @@ class StatisticSchoolDailyReportTask
shixun_increase_count: shixun_count, active_user_count: active_user_count, date: current_date
}
report = SchoolDailyReport.create!(create_params)
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}"
SchoolDailyActiveUser.connection.execute(user_sql)
if active_user_ids.present?
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}"
SchoolDailyActiveUser.connection.execute(user_sql)
end
end
end

Loading…
Cancel
Save