lib/splash/cli/transfers.rb in prometheus-splash-0.8.0 vs lib/splash/cli/transfers.rb in prometheus-splash-0.8.1

- old
+ new

@@ -42,11 +42,14 @@ desc "get_result TRANSFER", "Get specific result for a transfers " def get_result(name) log = get_logger log.item "Transfer : #{name}" config = get_config - data = TxRecords::new(name).get_all_records.select {|record,value| record == options[:date]}.first + data = TxRecords::new(name).get_all_records.select {|item| + record =item.keys.first + value=item[record] + record == options[:date]}.first if data.nil? then log.ko "Result for #{name} on date #{options[:date]} not found" splash_exit case: :not_found, :more => "Result inexistant" else record = options[:date] @@ -91,11 +94,13 @@ config = get_config if options[:table] then table = TTY::Table.new do |t| t << ["Start Date", "End date", "time", "Files count","File count error","Status"] t << ['','','','','',''] - TxRecords::new(name).get_all_records.each do |record,value| + TxRecords::new(name).get_all_records.each do |item| + record =item.keys.first + value=item[record] start_date = record end_date = (value[:end_date].nil?)? '': value[:end_date] time = (value[:time].nil?)? '': value[:time] count = (value[:count].nil?)? '': value[:count] failed = (value[:count].nil? or value[:done].nil?)? '': value[:count].to_i - value[:done].count @@ -109,10 +114,12 @@ else puts table.render(:ascii) end else - TxRecords::new(name).get_all_records.each do |record,value| + TxRecords::new(name).get_all_records.each do |item| + record =item.keys.first + value=item[record] failed = (value[:count].nil? or value[:done].nil?)? 'undef': value[:count].to_i - value[:done].count if value[:end_date].nil? then log.item "Event : #{record} STATUS : #{value[:status]}" else log.item "Tx Begin : #{record} => end : #{value[:end_date]} STATUS : #{value[:status]}"