Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- collection = collection_sort(collection_filter(scope: scope_to_apply, filter: collection_filters, included: [importer_log: [:stop_group]]))
- stop_groups = plannable_stop_groups(collection, current_account)
- stop_group_ids = stop_groups.pluck(:id)
- 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 }
- pagination = PaginationService.new(params, stop_groups)
- stops = Stop.where(stop_group_id: stop_group_ids)
- serializer_stop_groups = serializer_options.merge(params: { stops_not_geolocated_count: stops_not_geolocated_count, stops: stops })
- jsonapi_response(pagination, 200, serializer_stop_groups)
- attribute :stops_not_geolocated_count do |stop_group, params|
- result = params[:stops_not_geolocated_count].detect{|stop_group_id, _| stop_group.id == stop_group_id }.try(:last)
- result.nil? ? 0 : result
- end
- has_many :stops do |stop_group, params|
- params[:stops].try(:select) {|stop| stop.stop_group_id == stop_group.id }
- end
- 17:00 17:30 18:00 20:00
- 15:00 17:00 18:00 20:00
- Item: COCA-COLA SIN AZÚCAR 350 ML (381), quantity: 12, cost: 6980.0
- costo_item: 83760.0
- costo_item: 6980.0
- G service time
- min ventana horaria 2
- 1er caso 1 ventana horaria y el mismo dia, ventana horaria 1 min y max
- 2do caso fecha min y max mismo dia, ventana horaria 2 con su min y max
- 3er caso 2 dias fecha min 8 y max 9, dos bloques ambos son iguales solo una ventana horaria 2 ids
- 4to caso 2 dias fecha min 8 y max 9, dos ventanas 4 ids
- stop_keys = %i[identification latitude longitude address]
- 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]
- stop.items.each.with_index(1) do |item, index|
- 22.times.with_index(1) do |_, time_index|
- stop_keys.each_with_index do |el, stop_index|
- expect(sheet.rows[index].cells[stop_index].value).to eq stop.send(el).to_s
- end
- end
- end
- 22.times.with_index(13) do |_, time_index|
- stop_keys_two.each.with_index(1) do |el, stop_index|
- byebug
- expect(sheet.rows[stop_index].cells[time_index].value).to eq stop.send(el).to_s
- end
- break if time_index == 22
- end
- stop.items.each.with_index(1) do |item, index|
- 22.times.with_index(13) do |_, time_index|
- stop_keys_two.each_with_index do |el, stop_index|
- byebug
- expect(sheet.rows[index].cells[time_index].value).to eq stop.send(el).to_s
- end
- break if time_index == 22
- end
- end
- 2do caso
- if manual_invoicing.nil?
- return true
- elsif manual_invoicing > Time.now
- return false
- else
- return true
- end
- return true if manual_invoicing.nil?
- manual_invoicing > Time.now ? true : false
- # add validates in model unique by invoice_draft_id
- validates_uniqueness_of :invoice_draft_id
- if !DraftComment.exists?(invoice_draft_id: draft_params['invoice_draft_id'])
- comment = DraftComment.new(draft_params)
- if comment.save
- # callback after_save
- invoice = InvoiceDraft.find_by(id: draft_params['invoice_draft_id'])
- invoice.hqr.add_manual_flag unless !comment.commented?
- render json: comment, status: :created
- else
- render json: comment.errors, status: :unprocessable_entity
- end
- else
- render json: {'error': 'Comment Already Exists'}, status: :bad_request
- end
- 3 >= 5 || 1 == 2 && 7 < 8
- planner_3: 4ebf646227aef2307bbc6bf09b602bf7c4a8c8b07f1c63cce90d391a4a16924d
- enum %[restrictive informative ]
- crear tests para workers
- app/workers/planner/export/json_route_exporter_worker.rb
- app/workers/planner/export/plan_outbound_worker.rb
- arrived_at, primer despacho is_pickup true
- Section.find_or_create_by(name: "route_config")
- Section.find_or_create_by(name: 'planning_config')
- Section.find_or_create_by(name: 'api_config')
- Section.find_or_create_by(name: 'account')
- Section.find_or_create_by(name: 'user')
- Section.find_or_create_by(name: 'administrator')
- Section.find_or_create_by(name: 'export_config')
- Section.find_or_create_by(name: 'billing')
- boleta de deposito por excedente
- 22 78 25 100
- 1 routa desde ecentral a las condes
- 80 stops (guias)
- pero 10 van al negocio de la esquina -> 1er delivery point
- pero 70 van al lider -> 2do delivery point
- fetch: plan -> plan solutions
- fetch: rutas
- planner_plan_solutions/id/calculate ->>>>> fetch
- access_key_id = 'AKIA36U65XRH5NUPFYGH'
- secret_access_key = '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'
- region = 'us-west-2'
- data
- current_account = Account.first
- contacts = current_account.contacts.first(10).map(&:id)
- groups = Group.first(10).map(&:id)
- ReviewConfiguration.create(account_id: current_account.id, question: "como estuvo la entrega")
- dispatch_guides = current_account.dispatch_guides.first(10).pluck(:id)
- dispatches = current_account.dispatches.first(10).pluck(:id)
- truck_drivers = current_account.truck_drivers.first(10).pluck(:id)
- 10.times.each_with_index do |_, index|
- 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)
- end
- DispatchGuide.where(id: dispatch_guides).each_with_index do |dg, index|
- dg.update(contact_id: contacts[index])
- end
- TruckDriver.where(id: truck_drivers).each_with_index do |td, index|
- td.update(group_id: groups[index])
- end
- rails g model FileExporter status:integer account_id:integer:index file_path:string
- Exporter model
- enum status: %i[created processing error success]
- validates :status, inclusion: { in: statuses.keys, message: :invalid }
- def check_from_date
- one_month_ago = Time.now - 1.month
- render json: { msg: 'error range date' } if from < one_month_ago
- end
- query
- question = current_account.review_configuration.question
- current_account.reviews.each do |review|
- 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}"
- end
- app/importer/stop_entities_importer.rb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement