From e7f84c7e84ca703cd4fb9aab2564a1643b80f86f Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Tue, 27 Jun 2023 15:48:08 +0200 Subject: [PATCH] store timefmt and restore on reload --- lib/MojoFacets/Data.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index e1dc8ac..eceafb7 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -69,6 +69,9 @@ sub index { find( sub { my $file = $File::Find::name; + + next if $file =~ m/.timefmt$/; + if ( -f $file && $file =~ m/([^\/]+)\.changes\/(\d+[\.,]\d+.+)/ ) { push @{ $changes->{$1} }, $2 } elsif ( import_module( $file ) ) { @@ -261,6 +264,11 @@ sub _load_path { $loaded->{ $path } = $info; $self->_save( $path ) unless $info->{generated}; + my $timefmt_path = $self->_permanent_path( 'timefmt' ); + if ( -e $timefmt_path ) { + $self->session( 'timefmt', read_file $timefmt_path ); + } + } @@ -734,6 +742,14 @@ sub items { $self->_switch_dataset; + if ( my $timefmt = $self->param('timefmt') ) { + $self->session('timefmt', $timefmt); + warn "session store timefmt $timefmt\n"; + my $timefmt_path = $self->_permanent_path( 'timefmt' ); + write_file $timefmt_path, $timefmt; + warn "## $timefmt_path $timefmt" + } + if ( my $show = $self->param('id') ) { $self->param('show', $show); warn "show $show\n"; -- 2.20.1