lib/atome/kernel/universe.rb in atome-0.5.6.5.7 vs lib/atome/kernel/universe.rb in atome-0.5.6.6.0

- old
+ new

@@ -240,34 +240,36 @@ @history[action_nb][:sync] = true end def historicize(id, operation, element, params) - if @allow_history && @database_ready - A.sync({ action: :historicize, data: { table: :user } }) do |_db_state| - end + # if @allow_history && @database_ready + if @allow_history + # A.sync({ action: :historicize, data: { table: :user } }) do |_db_state| + # end operation_timing = Time.now.strftime("%Y%m%d%H%M%S%3N") + @increment.to_s @increment += 1 @increment = @increment % 100 JS.global[:localStorage].setItem(operation_timing, "{ #{id} => { #{operation} => { #{element} => #{params} } }, sync: false }") @history[@history.length] = { operation_timing => { id => { operation => { element => params } }, sync: false, time: Time.now } } end end - def story(filter) - # temp algo awaiting db to be ready, just for POC and tests - return unless filter - - operation = filter[:operation] - atome_id = filter[:id] - particle = filter[:particle] - filtered_history = [] - @history.each do |operation_number, alteration| - if alteration[atome_id] && (alteration[atome_id][operation]) && (alteration[atome_id][operation][particle]) - filtered_history << { operation: operation_number, filter[:particle] => alteration[atome_id][operation][particle], sync: alteration[:sync], time: alteration[:time] } - end - end - filtered_history + def story + @history + # # temp algo awaiting db to be ready, just for POC and tests + # return unless filter + # + # operation = filter[:operation] + # atome_id = filter[:id] + # particle = filter[:particle] + # filtered_history = [] + # @history.each do |operation_number, alteration| + # if alteration[atome_id] && (alteration[atome_id][operation]) && (alteration[atome_id][operation][particle]) + # filtered_history << { operation: operation_number, filter[:particle] => alteration[atome_id][operation][particle], sync: alteration[:sync], time: alteration[:time] } + # end + # end + # filtered_history end end end