- my $i = $unique2id->{$pk}->{$id};
- my $status = defined $i ? 'found' : 'missing';
- $e->{_status} = $status;
- $stats->{$status}++;
+ $status = 'missing';
+ if ( my $i = $unique2id->{$pk}->{$id} ) {
+ if ( _hash_eq( $e->{old}, $items->[$i]->{$e->{column}} ) ) {
+ $status = 'found';
+ if ( $commit ) {
+ my $column = $e->{column} or die "no column";
+ $items->[$i]->{$column} = $e->{new};
+ warn "# commit $i $column ",dump( $e->{new} );
+ $invalidate_columns->{$column}++;
+ }
+ } else {
+ $status = 'source-changed';
+ }
+ }
+ } elsif ( my $code = $e->{code} ) {
+ if ( $commit ) {
+ my $commit_changed;
+ my $t = time();
+ foreach my $i ( 0 .. $#$items ) {
+ MojoFacets::Data::__commit_path_code( $on_path, $i, $code, \$commit_changed );
+ }
+ $t = time() - $t;
+ $self->stash( 'commit_changed', $commit_changed );
+ warn "commit_changed in $t s ",dump( $e->{commit_changed}, $commit_changed );
+ $e->{commit_changed_this} = $commit_changed;
+ MojoFacets::Data::__invalidate_path_column( $on_path, $_ ) foreach keys %$commit_changed;
+ MojoFacets::Data::__path_rebuild_stats( $on_path );
+ }
+ $status = 'code';
+ if ( ( $apply || $commit ) && $e->{commit_changed} ) {
+ $status = 'found';
+ foreach my $c ( keys %{ $e->{commit_changed} } ) {
+ $status = 'missing' unless defined $MojoFacets::Data::loaded->{$path}->{stats}->{$c};
+ }
+ }
+ } else {
+ $status = 'unknown';