my $report_id = $params{report_id} || $::form->{id};
$self->{report} = SL::DB::Manager::CsvImportReport->find_by(id => $report_id);
- my $num_rows = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id ]);
+ my $num_rows = $self->{report}->numrows;
my $num_cols = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id, row => 0 ]);
# manual paginating, yuck
$pages->{cur} = $page < 1 ? 1
: $page > $pages->{max} ? $pages->{max}
: $page;
- $pages->{common} = SL::DB::Helper::Paginated::make_common_pages($pages->{cur}, $pages->{max});
+ $pages->{common} = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{cur}, $pages->{max}) } ];
$self->{display_rows} = [
0,
profile => $clone_profile,
type => $self->type,
file => '',
+ numrows => scalar @{ $self->data },
)->save(cascade => 1);
my $dbh = $::form->get_standard_dbh;
profile_id => { type => 'integer', not_null => 1 },
type => { type => 'text', not_null => 1 },
file => { type => 'text', not_null => 1 },
+ numrows => { type => 'integer' },
],
primary_key_columns => [ 'id' ],
session_id TEXT NOT NULL,
profile_id INTEGER NOT NULL REFERENCES csv_import_profiles(id),
type TEXT NOT NULL,
- file TEXT NOT NULL
+ file TEXT NOT NULL,
+ numrows INTEGER NOT NULL,
);
CREATE TABLE csv_import_report_rows (
);
ALTER TABLE csv_import_profiles DROP constraint "csv_import_profiles_name_key";
+
+CREATE INDEX "csv_import_report_rows_index_row" ON csv_import_report_rows (row);