Advertisement
NameL3ss

nose1

May 30th, 2021
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. collection = collection_sort(collection_filter(scope: scope_to_apply, filter: collection_filters, included: [importer_log: [:stop_group]]))
  2. stop_groups = plannable_stop_groups(collection, current_account)
  3.  
  4. stop_group_ids = stop_groups.pluck(:id)
  5. stops_not_geolocated_count = StopGroup.where(id: stop_group_ids).joins(:stops).where(stops: {latitude: nil, longitude: nil}).pluck(:id).each_with_object(Hash.new(0)) { |stop_id, hash| hash[stop_id] += 1 }
  6. pagination = PaginationService.new(params, stop_groups)
  7.  
  8. stops = Stop.where(stop_group_id: stop_group_ids)
  9.  
  10. serializer_stop_groups = serializer_options.merge(params: { stops_not_geolocated_count: stops_not_geolocated_count, stops: stops })
  11. jsonapi_response(pagination, 200, serializer_stop_groups)
  12.  
  13.  
  14. attribute :stops_not_geolocated_count do |stop_group, params|
  15. result = params[:stops_not_geolocated_count].detect{|stop_group_id, _| stop_group.id == stop_group_id }.try(:last)
  16. result.nil? ? 0 : result
  17. end
  18.  
  19. has_many :stops do |stop_group, params|
  20. params[:stops].try(:select) {|stop| stop.stop_group_id == stop_group.id }
  21. end
  22.  
  23.  
  24. 17:00 17:30 18:00 20:00
  25.  
  26. 15:00 17:00 18:00 20:00
  27.  
  28.  
  29.  
  30. Item: COCA-COLA SIN AZÚCAR 350 ML (381), quantity: 12, cost: 6980.0
  31. costo_item: 83760.0
  32. costo_item: 6980.0
  33.  
  34. G service time
  35. min ventana horaria 2
  36.  
  37. 1er caso 1 ventana horaria y el mismo dia, ventana horaria 1 min y max
  38. 2do caso fecha min y max mismo dia, ventana horaria 2 con su min y max
  39. 3er caso 2 dias fecha min 8 y max 9, dos bloques ambos son iguales solo una ventana horaria 2 ids
  40. 4to caso 2 dias fecha min 8 y max 9, dos ventanas 4 ids
  41.  
  42.  
  43.  
  44. stop_keys = %i[identification latitude longitude address]
  45. stop_keys_two = %i[total_cost total_capacity_one total_capacity_two service_time priority contact_identification contact_name contact_phone contact_email place_name]
  46. stop.items.each.with_index(1) do |item, index|
  47. 22.times.with_index(1) do |_, time_index|
  48. stop_keys.each_with_index do |el, stop_index|
  49. expect(sheet.rows[index].cells[stop_index].value).to eq stop.send(el).to_s
  50. end
  51. end
  52. end
  53.  
  54. 22.times.with_index(13) do |_, time_index|
  55. stop_keys_two.each.with_index(1) do |el, stop_index|
  56. byebug
  57. expect(sheet.rows[stop_index].cells[time_index].value).to eq stop.send(el).to_s
  58. end
  59. break if time_index == 22
  60. end
  61.  
  62.  
  63. stop.items.each.with_index(1) do |item, index|
  64. 22.times.with_index(13) do |_, time_index|
  65. stop_keys_two.each_with_index do |el, stop_index|
  66. byebug
  67. expect(sheet.rows[index].cells[time_index].value).to eq stop.send(el).to_s
  68. end
  69. break if time_index == 22
  70. end
  71. end
  72.  
  73.  
  74.  
  75. 2do caso
  76.  
  77. if manual_invoicing.nil?
  78. return true
  79. elsif manual_invoicing > Time.now
  80. return false
  81. else
  82. return true
  83. end
  84.  
  85.  
  86.  
  87.  
  88. return true if manual_invoicing.nil?
  89.  
  90. manual_invoicing > Time.now ? true : false
  91.  
  92.  
  93. # add validates in model unique by invoice_draft_id
  94. validates_uniqueness_of :invoice_draft_id
  95.  
  96. if !DraftComment.exists?(invoice_draft_id: draft_params['invoice_draft_id'])
  97. comment = DraftComment.new(draft_params)
  98. if comment.save
  99. # callback after_save
  100. invoice = InvoiceDraft.find_by(id: draft_params['invoice_draft_id'])
  101. invoice.hqr.add_manual_flag unless !comment.commented?
  102. render json: comment, status: :created
  103. else
  104. render json: comment.errors, status: :unprocessable_entity
  105. end
  106. else
  107. render json: {'error': 'Comment Already Exists'}, status: :bad_request
  108. end
  109.  
  110.  
  111.  
  112.  
  113.  
  114. 3 >= 5 || 1 == 2 && 7 < 8
  115.  
  116.  
  117.  
  118.  
  119.  
  120. planner_3: 4ebf646227aef2307bbc6bf09b602bf7c4a8c8b07f1c63cce90d391a4a16924d
  121.  
  122.  
  123. enum %[restrictive informative ]
  124.  
  125. crear tests para workers
  126. app/workers/planner/export/json_route_exporter_worker.rb
  127. app/workers/planner/export/plan_outbound_worker.rb
  128.  
  129.  
  130.  
  131. arrived_at, primer despacho is_pickup true
  132.  
  133.  
  134. Section.find_or_create_by(name: "route_config")
  135. Section.find_or_create_by(name: 'planning_config')
  136. Section.find_or_create_by(name: 'api_config')
  137. Section.find_or_create_by(name: 'account')
  138. Section.find_or_create_by(name: 'user')
  139. Section.find_or_create_by(name: 'administrator')
  140. Section.find_or_create_by(name: 'export_config')
  141. Section.find_or_create_by(name: 'billing')
  142.  
  143. boleta de deposito por excedente
  144. 22 78 25 100
  145.  
  146. 1 routa desde ecentral a las condes
  147. 80 stops (guias)
  148. pero 10 van al negocio de la esquina -> 1er delivery point
  149. pero 70 van al lider -> 2do delivery point
  150.  
  151.  
  152. fetch: plan -> plan solutions
  153.  
  154. fetch: rutas
  155.  
  156.  
  157. planner_plan_solutions/id/calculate ->>>>> fetch
  158.  
  159. access_key_id = 'AKIA36U65XRH5NUPFYGH'
  160. secret_access_key = '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'
  161. region = 'us-west-2'
  162.  
  163. data
  164.  
  165. current_account = Account.first
  166. contacts = current_account.contacts.first(10).map(&:id)
  167. groups = Group.first(10).map(&:id)
  168. ReviewConfiguration.create(account_id: current_account.id, question: "como estuvo la entrega")
  169. dispatch_guides = current_account.dispatch_guides.first(10).pluck(:id)
  170. dispatches = current_account.dispatches.first(10).pluck(:id)
  171. truck_drivers = current_account.truck_drivers.first(10).pluck(:id)
  172.  
  173. 10.times.each_with_index do |_, index|
  174. Review.create!(comment: "prueba #{index}", score: rand(1..5), dispatch_guide_id: dispatch_guides[index], dispatch_id: dispatches[index], truck_driver_id: truck_drivers[index], review_configuration_id: 1)
  175. end
  176.  
  177. DispatchGuide.where(id: dispatch_guides).each_with_index do |dg, index|
  178. dg.update(contact_id: contacts[index])
  179. end
  180.  
  181. TruckDriver.where(id: truck_drivers).each_with_index do |td, index|
  182. td.update(group_id: groups[index])
  183. end
  184.  
  185. rails g model FileExporter status:integer account_id:integer:index file_path:string
  186.  
  187. Exporter model
  188. enum status: %i[created processing error success]
  189. validates :status, inclusion: { in: statuses.keys, message: :invalid }
  190.  
  191.  
  192. def check_from_date
  193. one_month_ago = Time.now - 1.month
  194. render json: { msg: 'error range date' } if from < one_month_ago
  195. end
  196.  
  197. query
  198. question = current_account.review_configuration.question
  199.  
  200. current_account.reviews.each do |review|
  201. p "question: #{question.gsub(/[?]/, " #{review.truck_driver.try(:name)}?")} truck_driver_name: #{review.truck_driver.name}, score: #{review.score}, dispatch_guide: #{review.dispatch_guide_id}, empresa: #{review.truck_driver.group.try(:name)}, comment: #{review.comment}"
  202. end
  203.  
  204. app/importer/stop_entities_importer.rb
  205.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement