diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 758e14157e6..edeb481c91e 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -380,7 +380,7 @@ class AccountsController < ApplicationController def run_report if authorized_action(@context, @current_user, :read_reports) - student_report = AccountReport.new(:user=>@current_user, :account=>@account, :report_type=>params[:report_type]) + student_report = AccountReport.new(:user=>@current_user, :account=>@account, :report_type=>params[:report_type], :parameters=>params[:parameters]) student_report.workflow_state = :running student_report.progress = 0 student_report.save diff --git a/app/models/account_report.rb b/app/models/account_report.rb index bd71f28c1d2..cb67073f73d 100644 --- a/app/models/account_report.rb +++ b/app/models/account_report.rb @@ -24,6 +24,8 @@ class AccountReport < ActiveRecord::Base belongs_to :user belongs_to :attachment + serialize :parameters + workflow do state :created state :running diff --git a/app/views/accounts/settings.html.erb b/app/views/accounts/settings.html.erb index c2a89551bb2..8ba11f9b00b 100644 --- a/app/views/accounts/settings.html.erb +++ b/app/views/accounts/settings.html.erb @@ -390,6 +390,8 @@ description = details[:description] description_partial = details[:description_partial] description_partial = report + '_description' if description_partial == true + parameters_partial = details[:parameters_partial] + parameters_partial = report + '_parameters' if parameters_partial == true last_run = @last_reports[report] %>
@@ -411,6 +413,9 @@
The report is running. You'll receive an email when it is done. +
+ <%= render :partial => parameters_partial if parameters_partial %> +
Run this report now
diff --git a/db/migrate/20110525175614_add_parameters_to_account_reports.rb b/db/migrate/20110525175614_add_parameters_to_account_reports.rb new file mode 100644 index 00000000000..8d318d95b17 --- /dev/null +++ b/db/migrate/20110525175614_add_parameters_to_account_reports.rb @@ -0,0 +1,9 @@ +class AddParametersToAccountReports < ActiveRecord::Migration + def self.up + add_column :account_reports, :parameters, :text + end + + def self.down + remove_column :account_reports, :parameters + end +end diff --git a/public/javascripts/account_settings.js b/public/javascripts/account_settings.js index e97a5d830f1..bfe3f6ae368 100644 --- a/public/javascripts/account_settings.js +++ b/public/javascripts/account_settings.js @@ -120,6 +120,7 @@ $(document).ready(function() { resetForm: true, beforeSubmit: function(data) { $(this).find('.run_report_link').hide(); + $(this).find('.report_parameters').hide(); $(this).find('.running_report_message').show(); return true; },