educode_sales 1.10.5 → 1.10.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/educode_sales/assessments_controller.rb +17 -23
- data/lib/educode_sales/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac101917e54365aede7a60619e9caf0be8de80ed94145e3abd9449a710444235
|
4
|
+
data.tar.gz: f78e765716fe9842703fbc8a66c9f7bd589843c940304da3b3ae65ac4f67db28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96c916670d4f3e696c00378e5f94934ef9ea294968deac363f2ea0a043235d6215fd466729a9084ad6cd2899a583f111433f3cdef3cbc055c10e18640d8d61b
|
7
|
+
data.tar.gz: 4d3db639eb7d38180600e00a565502f71dfd19803abe213cb657edcc9b4bf2e7869399049edd5592e07856d15fda1b1a7d9b214147555a5cd4fb19dbf9040039
|
@@ -437,14 +437,8 @@ module EducodeSales
|
|
437
437
|
#导入签到记录接口
|
438
438
|
def import_attendances
|
439
439
|
render_failure("文件不存在或格式错误") if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
|
440
|
-
|
441
|
-
begin
|
442
|
-
doc = SimpleXlsxReader.open(params[:file])
|
443
|
-
rescue
|
444
|
-
return render_error("文件不存在或格式错误")
|
445
|
-
end
|
440
|
+
doc = SimpleXlsxReader.open(params[:file].to_io)
|
446
441
|
size = doc.sheets.size
|
447
|
-
Rails.logger.info size
|
448
442
|
attendance_attrs = %i[name attendance_date longitude latitude location address mobile_id ip_address customer target created_at updated_at]
|
449
443
|
attendance_vales = []
|
450
444
|
(0..size - 1).each do |index|
|
@@ -456,23 +450,23 @@ module EducodeSales
|
|
456
450
|
longitude = d[3]
|
457
451
|
latitude = d[4]
|
458
452
|
location = d[5]
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
453
|
+
address = d[6]
|
454
|
+
mobile_id = d[7]
|
455
|
+
ip_address = d[8]
|
456
|
+
customer = d[9]
|
457
|
+
target = d[10]
|
458
|
+
attendance_vales << {name: name, attendance_date: attendance_date, longitude: longitude, latitude: latitude, location: location,
|
459
|
+
address: address, mobile_id: mobile_id, ip_address: ip_address, customer: customer, target: target}
|
466
460
|
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
461
|
+
end
|
462
|
+
end
|
463
|
+
EducodeSales::Attendance.bulk_insert(*attendance_attrs) do |worker|
|
464
|
+
attendance_vales.each do |attendance|
|
465
|
+
worker.add(name: attendance[:name], attendance_date: attendance[:attendance_date].to_datetime, longitude: attendance[:longitude], latitude: attendance[:latitude],
|
466
|
+
location: attendance[:location], address: attendance[:address], mobile_id: attendance[:mobile_id], ip_address: attendance[:ip_address], customer: attendance[:customer], target: attendance[:target])
|
467
|
+
end
|
468
|
+
end
|
469
|
+
render_success
|
476
470
|
end
|
477
471
|
|
478
472
|
|