Skip to content

Commit

Permalink
data export
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Dec 5, 2023
1 parent 060c46e commit 61a6c8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
9 changes: 0 additions & 9 deletions app/models/datum/model/data_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,13 @@ module Model::DataList
has_many :table_items, through: :table_lists

scope :published, -> { where(published: true) }

before_create :update_parameters, if: -> { type == 'Datum::DataExport' }
end

def rebuild!
update_parameters
self.save
end

def update_parameters
export.parameters.each do |p|
self.parameters[p] = nil
end
self.x_position = export.columns.index { |i| i[:x_axis] }
end

def export
@export ||= data_table.to_s.safe_constantize
end
Expand Down
11 changes: 11 additions & 0 deletions app/models/datum/model/data_list/data_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ module Datum
module Model::DataList::DataExport
extend ActiveSupport::Concern

included do
before_create :update_parameters
end

def update_parameters
export.parameters.each do |p|
self.parameters[p] = nil
end
self.x_position = export.columns.index { |i| i[:x_axis] }
end

def just_run
end

Expand Down

0 comments on commit 61a6c8d

Please sign in to comment.