fix timefmt load into session position
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 27 Jun 2023 20:48:38 +0000 (22:48 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Wed, 28 Jun 2023 07:00:47 +0000 (09:00 +0200)
lib/MojoFacets/Data.pm

index eceafb7..c715f6f 100644 (file)
@@ -264,10 +264,6 @@ 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 );
-       }
 
 }
 
@@ -293,6 +289,13 @@ sub load {
 
        $self->session( 'path' => $path );
 
+       my $timefmt_path = $self->_permanent_path( 'timefmt' );
+       if ( -e $timefmt_path ) {
+               my $timefmt = read_file $timefmt_path;
+               $self->session( 'timefmt', $timefmt );
+               warn "timefmt = ", $timefmt;
+       }
+
        my $redirect_to = '/data/items';
 
        $self->session( 'header' => $loaded->{$path}->{header} );
@@ -429,6 +432,7 @@ sub columns {
                return $self->redirect_to('/data/items');
 
        } elsif ( ! $self->session('header') ) {
+               return $self->redirect_to('/');
                return $self->redirect_to('/data/load');
        }