revision and fix episode numbers

episodes can be checked and fixed. On checking errors and warnings are
displayed.  Once only warnings exist, episodes can be fixed.
This commit is contained in:
Milan
2020-02-29 21:58:11 +01:00
parent eb2986e1da
commit b00704cc4b
7 changed files with 261 additions and 23 deletions

View File

@@ -41,8 +41,6 @@ sub save_content($$) {
my $config = shift;
my $entry = shift;
my $dbh = db::connect($config);
return undef unless ( defined $entry->{id} );
for my $attr ( keys %$entry ) {
@@ -100,15 +98,35 @@ sub save_content($$) {
where id=?
};
#print STDERR "update:".$query.Dumper(\@bind_values);
my $dbh = db::connect($config);
my $result = db::put( $dbh, $query, \@bind_values );
unless ( defined $result ) {
print STDERR "error on updating event\n";
return undef;
}
#print STDERR "result=$result\n";
#print STDERR "entr after update".Dumper($entry);
return $entry;
}
sub set_episode{
my $config = shift;
my $entry = shift;
return undef unless ( defined $entry->{id} );
return undef unless ( defined $entry->{episode} );
my $query = qq{
update calcms_events
set episode=?
where id=?
};
my $bind_values= [ $entry->{episode}, $entry->{id} ];
my $dbh = db::connect($config);
my $result = db::put( $dbh, $query, $bind_values );
unless ( defined $result ) {
print STDERR "error on setting episode in event\n";
return undef;
}
return $entry;
}