Class: EducodeSales::SaleTrendsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- EducodeSales::SaleTrendsController
- Includes:
- SaleTrendsCountHelper, SaleTrendsHelper
- Defined in:
- app/controllers/educode_sales/sale_trends_controller.rb
Constant Summary
Constants included from SaleTrendsCountHelper
EducodeSales::SaleTrendsCountHelper::NAMES
Constants included from SaleTrendsHelper
EducodeSales::SaleTrendsHelper::NAMES
Instance Method Summary collapse
-
#business_area ⇒ Object
商机区域分布.
-
#business_followup_analysis ⇒ Object
商机跟进数.
- #goal_forecast ⇒ Object
- #operations ⇒ Object
- #sale_trends ⇒ Object
-
#sales_analysis ⇒ Object
销售额分析.
-
#sales_followup_analysis ⇒ Object
销售人员跟进分析.
- #trends ⇒ Object
- #user_stat ⇒ Object
Methods included from SaleTrendsCountHelper
#goal_forecast_month_count, #goal_forecast_quarter_count, #goal_forecast_week_count, #goal_forecast_year_count
Methods included from SaleTrendsHelper
#goal_forecast_month, #goal_forecast_quarter, #goal_forecast_week, #goal_forecast_year
Methods inherited from ApplicationController
#authenticate_admin, #authenticate_request, #current_user, #filter, #render_failure, #render_success
Instance Method Details
#business_area ⇒ Object
商机区域分布
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 226 def business_area respond_to do |format| format.html do end format.js do @business_types = EducodeSales::Common.where(clazz: 'business_type').where.not(extras: "x_class").map { |d| {name: d.name, value: d.id } } @select_business_type = params[:business_type].present? ? params[:business_type].split(",") : [] x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id provinces = EducodeSales::Common.where(clazz: 'area').pluck(:name) if params[:business_count_type] == 'money' || params[:business_count_type].blank? data = provinces.map { |province| if params[:business_type].blank? Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:budget_amount).round(2) else Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).sum(:budget_amount).round(2) end } if params[:sort_by].present? data_hash = [] data.each_with_index do |d, i| data_hash << {id: i, num: d} end data_hash.sort! { |a, b| params[:sort_by] == 'asc' ? a[:num] <=> b[:num] : b[:num] <=> a[:num] } data = [] provinces_sort = [] data_hash.each_with_index do |d| data << d[:num] provinces_sort << provinces[d[:id]] end provinces = provinces_sort end @business_data = { labels: provinces, datasets: [ { label: "商机总额", data: data, backgroundColor: SaleTrend::COLORS[0], borderColor: SaleTrend::COLORS[0], borderWidth: 1 } ] } else data = provinces.map { |province| if params[:business_type].blank? Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).count else Business.joins(:last_follow_up).where("educode_sales_businesses.department_id in (?)", School.joins(:departments).where(province: province).pluck("departments.id")).where("educode_sales_follow_ups.clazz_id in (?)", params[:business_type].split(",")).count end } if params[:sort_by].present? data_hash = [] data.each_Wit_index do |d, i| data_hash << {id: i, num: d} end data_hash.sort! { |a, b| params[:sort_by] == 'asc' ? a[:num] <=> b[:num] : b[:num] <=> a[:num] } data = [] provinces_sort = [] data_hash.each_with_index do |d| data << d[:num] provinces_sort << provinces[d[:id]] end provinces = provinces_sort end @business_data = { labels: provinces, datasets: [ { label: "商机数量", data: data, backgroundColor: SaleTrend::COLORS[0], borderColor: SaleTrend::COLORS[0], borderWidth: 1 } ] } end end end end |
#business_followup_analysis ⇒ Object
商机跟进数
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 86 def business_followup_analysis common = EducodeSales::Common.find_by(clazz: 'staff_type', name: '销售') names = EducodeSales::Staff.includes(:user).where(job_type: common.id).map { |d| [d.user.real_name, d.id, d.role_id] } x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id x_business_ids = EducodeSales::Business.joins(last_follow_up: :clazz).where("educode_sales_commons.id = ?",x).pluck :id @follow_count_range = params[:follow_count_range] || "week" # 商机跟进数图表 respond_to do |format| format.html do end format.js do default_dates = (30.day.ago.to_date..Date.today).map { |d| d.strftime("%Y-%W") }.uniq #默认时间范围 @follow_count_data = business_followup_charts(default_dates, names, x_business_ids, SaleTrend::COLORS, [30.day.ago.to_date.beginning_of_week, Date.today], "%Y%u") do |default_dates| default_dates.map { |date| d = date.split("-") year = d[0].to_i week = d[1].to_i if week == 0 0 else month = Date.commercial(year, week).strftime("%m月%d日") day = Date.commercial(year, week, 7).strftime("%m月%d日") date.to_s + "(#{month}-#{day})" end } - [0] end end format.json do if params[:follow_count_range].present? case params[:follow_count_range] when "week" #按周 if params[:date_week].present? date = params[:date_week].split(" - ") # 年初第一天周数是0会导致周数重复计算 dates = (date[0].to_date..date[1].to_date).map { |d| d.strftime("%Y-%W") }.uniq.select { |d| d.split("-")[1] != '00' } @follow_count_data = business_followup_charts(dates, names, x_business_ids, SaleTrend::COLORS, date, "%Y%u") do |dates| dates.map { |date| d = date.split("-") year = d[0].to_i week = d[1].to_i if week == 0 0 else month = Date.commercial(year, week).strftime("%m月%d日") day = Date.commercial(year, week, 7).strftime("%m月%d日") date.to_s + "(#{month}-#{day})" end } - [0] end else return render json: {msg: '请选择时间范围', success: false } end when "month" #按月 if params[:date_month].present? date = params[:date_month].split(" - ") dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq @follow_count_data = business_followup_charts(dates, names, x_business_ids, SaleTrend::COLORS, [(date[0] + "-01").to_date, (date[1] + "-01").to_date.end_of_month], '%Y%m') else return render json: {msg: '请选择时间范围', success: false } end when "year" #按年 if params[:date_year].present? date = params[:date_year].split(" - ") dates = (date[0]..date[1]).to_a.map { |d| d.to_s} @follow_count_data = business_followup_charts(dates, names, x_business_ids, SaleTrend::COLORS, ["#{date[0]}-01-01".to_date.beginning_of_year, "#{date[1]}-01-01".to_date.end_of_year], '%Y') else return render json: {msg: '请选择时间范围', success: false } end else #按天 if params[:date].present? date = params[:date].split(" - ") dates = (date[0].to_date..date[1].to_date).to_a.map { |d| d.to_s} @follow_count_data = business_followup_charts(dates, names, x_business_ids, SaleTrend::COLORS, [date[0].to_date, date[1].to_date], '%Y%m%d') else return render json: {msg: '请选择时间范围', success: false } end end end render json: {data: @follow_count_data } end end end |
#goal_forecast ⇒ Object
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 390 def goal_forecast respond_to do |format| format.html do end format.js do if params[:forecast_type].blank? || params[:forecast_type] == "money" p "按金额" goal_forecast_money else p "按数量" goal_forecast_count end end end end |
#operations ⇒ Object
81 82 83 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 81 def operations end |
#sale_trends ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 72 def sale_trends sale_trend = SaleTrend.find_by(year: params[:year]) if sale_trend.update(sale_trend_params) render_success else render_failure sale_trend end end |
#sales_analysis ⇒ Object
销售额分析
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 174 def sales_analysis respond_to do |format| format.html do end format.js do x = EducodeSales::Common.find_by(extras: EducodeSales::Common::XTYPE)&.id count_type = params[:count_type] || "actual_amount" stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) @goal_count_range = params[:goal_count_range] || "month" goal_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y-%m") }.uniq sale_names = ['已中标', '已签单', '已回款'] common = Common.find_by(clazz: 'staff_type', name: '销售') staffs = Staff.joins(:user).where(job_type: common.id).where.not(role_id: 11) @staffs = staffs.map { |d| [d.user.real_name, d.id]} if params[:goal_count_range].present? case params[:goal_count_range] when "week" when "month" #按月 if params[:goal_date_month].present? date = params[:goal_date_month].split(" - ") date[0] = (date[0] + "-01").to_date.to_s date[1] = (date[1] + "-01").to_date.end_of_month.to_s dates = ((date[0] + "-01").to_date..(date[1] + "-01").to_date).map { |d| d.strftime("%Y-%m") }.uniq @goal_count_data = month_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, date) else @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}-01", "#{Time.now.year}-#{Time.now.month}"]) end else #按年 if params[:goal_date_year].present? date = params[:goal_date_year].split(" - ") dates = (date[0]..date[1]).to_a @goal_count_data = year_sale_chart(dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, date) else goal_default_dates = ("#{Time.now.year}-01-01".to_date.."#{Time.now.year}-#{Time.now.month}-01".to_date).map { |d| d.strftime("%Y") }.uniq @goal_count_data = year_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}", "#{Time.now.year}"]) end end else @goal_count_data = month_sale_chart(goal_default_dates, sale_names, SaleTrend::COLORS, x, stage_ids, s_stage_ids, count_type, ["#{Time.now.year}-01", "#{Time.now.year}-#{Time.now.month}"]) end end end end |
#sales_followup_analysis ⇒ Object
销售人员跟进分析
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 312 def sales_followup_analysis respond_to do |format| format.html do end format.js do # 销售人员跟进分析 @goal_count_range = params[:goal_count_range] || "month" begin_time = Time.now.at_beginning_of_year.to_s end_time = Time.now.at_end_of_year.to_s customer_time_range = params[:customer_time_range] case customer_time_range when 'last_week' begin_time = (Time.now - 1.week).at_beginning_of_week.to_s end_time = (Time.now - 1.week).at_end_of_week.to_s when 'this_week' begin_time = Time.now.at_beginning_of_week.to_s end_time = Time.now.at_end_of_week.to_s when 'last_month' begin_time = (Time.now - 1.month).at_beginning_of_month.to_s end_time = (Time.now - 1.month).at_end_of_month.to_s when 'this_month' begin_time = Time.now.at_beginning_of_month.to_s end_time = Time.now.at_end_of_month.to_s when 'last_year' begin_time = (Time.now - 1.year).at_beginning_of_year.to_s end_time = (Time.now - 1.year).at_end_of_year.to_s when 'this_year' begin_time = Time.now.at_beginning_of_year.to_s end_time = Time.now.at_end_of_year.to_s when 'all' begin_time = (Time.now - 5.year).at_beginning_of_year.to_s end_time = (Time.now + 5.year).at_end_of_year.to_s when 'diy' if params[:customer_date].present? date = params[:customer_date].split(" - ") begin_time = date[0] + " 00:00:00" end_time = date[1] + " 23:59:59" end end common = Common.find_by(clazz: 'staff_type', name: '销售') staff_names = Staff.joins(:user).where(job_type: common.id).map { |d| d.user.real_name } staff_ids = Staff.joins(:user).where(job_type: common.id).pluck(:id) if params[:customer_count_type] == 'money' || params[:customer_count_type].blank? @customer_data = { labels: staff_names, datasets: [ { label: "跟进客户数", data: staff_ids.map { |staff_id| (EducodeSales::CustomerFollow.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).pluck(:school_id) + EducodeSales::Business.where(id: EducodeSales::FollowUp.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).pluck(:business_id).uniq).pluck(:school_id)).uniq.size }, backgroundColor: SaleTrend::COLORS[0], borderColor: SaleTrend::COLORS[0], borderWidth: 1 } ] } else @customer_data = { labels: staff_names, datasets: [ { label: "跟进客户次数", data: staff_ids.map { |staff_id| EducodeSales::CustomerFollow.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).size + EducodeSales::FollowUp.where(staff_id: staff_id).where("created_at >= ? AND created_at <= ?", begin_time, end_time).size }, backgroundColor: SaleTrend::COLORS[0], borderColor: SaleTrend::COLORS[0], borderWidth: 1 } ] } end end end end |
#trends ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 8 def trends # authorize! :trends, EducodeSales::SaleTrend @year = params[:year] ? params[:year] : Time.now.year @years = ['全部'] + (1..(Time.now.year - 2014)).reverse_each.map { |d| 2014 + d } x = Common.find_by(extras: EducodeSales::Common::XTYPE)&.id o = Common.find_by(extras: EducodeSales::Common::OTYPE)&.id if (@year == '全部') @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).sum(:budget_amount).round(2) stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) # 中标总金额, 已回款总金额 total_return = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).select("sum(total_amount) AS total, sum(educode_sales_businesses.return_money) AS return_money") @goal_amount = total_return[0]['total']&.round(2) || 0 @actual_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).sum(:actual_amount).round(2) s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) @service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:total_amount).round(2) @actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", s_stage_ids).sum(:actual_amount).round(2) @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).sum(:amount).round(2) # # @return_amount = total_return[0]['return_money']&.round(2) || 0 # @receivable_amount = @goal_amount - @return_amount @receivable_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.stage_id IN (?)", stage_ids).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num") @receivable_amount = @receivable_amount.present? && @receivable_amount[0]['num'] ? @receivable_amount[0]['num'].round(2) : 0 a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id) @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).sum(:budget_amount).round(2) b = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::BTYPE)&.name).pluck(:id) @b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).sum(:budget_amount).round(2) else year_time = "#{@year}-01-01 00:00:00" year_over_time = "#{@year}-12-31 23:59:59" @sale_trend = SaleTrend.find_or_create_by(year: @year) @business_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ? AND educode_sales_follow_ups.clazz_id != ?", x, o).where("educode_sales_follow_ups.year <= ?", @year).sum(:budget_amount).round(2) stage_ids = Common.where(clazz: '商机阶段', name: ['已中标', '已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) # 中标总金额, 已回款总金额 total_return = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).select("sum(total_amount) AS total, sum(educode_sales_businesses.return_money) AS return_money") @goal_amount = total_return[0]['total']&.round(2) || 0 @actual_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date >= ? AND educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2) s_stage_ids = Common.where(clazz: '商机阶段', name: ['已签单', '已验收', '回款中', '服务中', '已结束']).pluck(:id) @service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:total_amount).round(2) @actual_service_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.signed_date >= ? AND educode_sales_follow_ups.signed_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-01-01", "#{@year}-12-31", s_stage_ids).sum(:actual_amount).round(2) @return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at >= ? AND educode_sales_money_plans.date_at <= ? ", year_time, year_over_time).sum(:amount).round(2) # 往年累计已中标合同 # @former_goal_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids).sum(:actual_amount).round(2) # # 往年累计已回款 # @former_return_amount = Business.joins(last_follow_up: :money_plans).where("educode_sales_follow_ups.clazz_id != ?", x).where.not("educode_sales_money_plans.clazz!= ?", 1).where("educode_sales_money_plans.date_at <= ? ", year_over_time).sum(:amount).round(2) # @receivable_amount = @former_goal_amount - @former_return_amount @receivable_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id != ?", x).where("educode_sales_follow_ups.bidded_date <= ? AND educode_sales_follow_ups.stage_id IN (?)", "#{@year}-12-31", stage_ids).select("(SUM(educode_sales_follow_ups.actual_amount) - SUM(educode_sales_businesses.return_money)) AS num") @receivable_amount = @receivable_amount.present? && @receivable_amount[0]['num'] ? @receivable_amount[0]['num'].round(2) : 0 a = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::ATYPE)&.name).pluck(:id) @a_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", a).where("educode_sales_follow_ups.year <= ?", @year).sum(:budget_amount).round(2) b = Common.where(clazz: '商机类型', name: Common.find_by(extras: EducodeSales::Common::BTYPE)&.name).pluck(:id) @b_amount = Business.joins(:last_follow_up).where("educode_sales_follow_ups.clazz_id IN (?)", b).where("educode_sales_follow_ups.year <= ?", @year).sum(:budget_amount).round(2) end end |
#user_stat ⇒ Object
406 407 408 409 410 411 412 413 414 415 416 417 418 |
# File 'app/controllers/educode_sales/sale_trends_controller.rb', line 406 def user_stat respond_to do |format| format.html do end format.js do user_stat = EducodeSales::UserStatService.new gon.table_1 = user_stat.table_1 gon.table_2 = user_stat.table_2(1) gon.table_3 = user_stat.table_3 end end end |