Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://backend.webdoxclm.com/v2/organizations/people/select_search?page=1&per_page=20
- {id: 1, value: "perro"}
- #<MassImportLogger:0x0000000142fe95c8
- id: 4,
- customer_id: 1,
- user_id: 1,
- scoped_id: 1,
- importer_type: "organization_companies_and_people",
- status: "pending",
- records:
- {"Document"=>[19, 20, 21],
- "Document_failed_ids"=>[12, 13, 14, 15, 16, 17, 18],
- "extra"=>{"20"=>{"document_name"=>"ciudades", "document_attribute_options"=>["arica", "santiago"]}, "21"=>{"document_name"=>"tipo de archivos", "document_attribute_options"=>["tmp"]}}},
- errors_count: {"Document"=>3},
- created_at: Tue, 03 Jun 2025 12:56:21 -04 -04:00,
- updated_at: Thu, 05 Jun 2025 22:18:17 -04 -04:00,
- uploaded_excel_file_name: nil,
- uploaded_excel_content_type: nil,
- uploaded_excel_file_size: nil,
- uploaded_excel_updated_at: nil,
- errors_excel_file_name: nil,
- id document_metadata_type document_metadata_id metadata mass_import_log
- 1. "Document". "1", { error => [{name: {"name already taken"}] }, 1
- 2 "DocumentAttribute", "2", { "document_attribute_values"=>["arica", "santiago"] }, 1
- app/services/mass_import/classification/document_classification_row.rb
- dynamic_attr son los values a crear son los que vienen del excel crear un geter con estos elementos
- document_attribute_values traer todos los values de todos los documentos que se intentan clasificar
- app/services/mass_import/sheet_import.rb
- linea 27
- al row_class sacarle los dynamic_attr
- hacer resta entre dynamic_attr vs todos los values y esto insertar en una tabla
- para poder saber que nuevos valores se crearon en la clasificacion
- def import
- sheet.set_sheet_importer(self)
- total_rows = parsed_data.size
- notifier.set_sheet(sheet_name: translation_key, total_rows: total_rows)
- parsed_data.each do |row_data|
- row = row_class.new(customer, user, row_data, self)
- if row.save!
- @saved_records << row.record.id
- else
- @rows_with_errors << row
- end
- notifier.push_progress_event(translation_key)
- end
- aca hacer flujo resta
- end
- luego
- document.document_attribute_values.create!(attrs) if document.allows_create_options_on_classification?
- records = {
- "document" => {
- ids: [19, 20, 21],
- extra: {
- "20" => { document_attribute_options: ["arica", "santiago"] },
- "21" => { document_attribute_options: ["concepcion"] }
- }
- }
- }
- {
- "Document" => [19, 20, 21],
- "Document_failed_ids" => [12, 13, 14, 15, 16, 17, 18],
- "extra" => {
- "20" => { "document_name" => "ciudades", "document_attribute_options" => ["arica", "santiago"] },
- "21" => { "document_name" => "tipo de archivos", "document_attribute_options" => ["tmp"] }
- }
- }
- def index
- import_logs = current_customer
- .mass_import_logs
- .where(importer_type: : document_classification, status: [:completed, :failed, :canceled])
- .order(scoped_id: :desc)
- data, meta = CursorPaginatorService.new(
- resource: import_logs,
- limit: params[:limit],
- cursor: params[:cursor],
- cursor_column: :scoped_id,
- max_limit: params[:max_limit],
- order_direction: :desc
- ).paginate
- render json: ::MassImport::Classification::MassImportLoggerSerializer.new(data, index_opts(meta: meta)).serialized_json, status: :ok
- end
- def index_opts(attrs = {})
- {
- fields: {
- mass_import_log: %i[user_full_name status errors_count documents_count scoped_id total update_count]
- }
- }.merge(attrs)
- end
Advertisement
Add Comment
Please, Sign In to add comment