File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -475,6 +475,23 @@ sub fetch_orders ($order_id) {
475
475
}
476
476
477
477
478
+ # ----------------------------------------------------------------------
479
+ # From Act::Talk
480
+ # Another two subroutines which don't pass a conference because they
481
+ # refer to talks, which are associated with a conference.
482
+ sub delete_talk_attendance ($talk_id ) {
483
+ sql(' DELETE FROM user_talks WHERE talk_id=?' , $talk_id );
484
+ }
485
+
486
+ sub talk_stars ($talk_id ) {
487
+ my $sth = sql(' SELECT COUNT(*) FROM user_talks'
488
+ . ' WHERE talk_id=?' , $talk_id );
489
+ my ($count ) = $sth -> fetchrow_array();
490
+ $sth -> finish;
491
+ return $count || 0;
492
+ }
493
+
494
+
478
495
# ----------------------------------------------------------------------
479
496
# Fetch the database handler
480
497
sub dbh {
@@ -743,6 +760,15 @@ which is mapped to C<'t'> or C<'f'>.
743
760
Returns an array reference holding hash references for each of the
744
761
orders.
745
762
763
+ =head3 Act::Data::delete_talk_attendance ($talk_id)
764
+
765
+ Removes information about a talk's attendance (before deleting the
766
+ talk itself).
767
+
768
+ =head3 $count = Act::Data::talk_stars($talk_id)
769
+
770
+ Returns the number of stars for a talk given by its ID.
771
+
746
772
=head1 CAVEATS
747
773
748
774
The Act test suite doesn't exercise all of these functions. This is bad.
Original file line number Diff line number Diff line change 1
1
package Act::Talk ;
2
2
use Act::Config;
3
+ use Act::Data;
3
4
use Act::Object;
4
5
use base qw( Act::Object ) ;
5
6
@@ -32,18 +33,15 @@ our %sql_opts = ( 'order by' => 'talk_id' );
32
33
sub delete {
33
34
my ($self , %args ) = @_ ;
34
35
35
- sql( ' DELETE FROM user_talks WHERE talk_id=? ' , $self -> talk_id);
36
+ Act::Data::delete_talk_attendance( $self -> talk_id);
36
37
37
38
$self -> SUPER::delete (%args );
38
39
$Request {dbh }-> commit;
39
40
}
40
41
41
42
sub stars {
42
43
my ($self , %args ) = @_ ;
43
- my $sth = sql(' SELECT COUNT(*) FROM user_talks WHERE talk_id=?' , $self -> talk_id);
44
- my ($count ) = $sth -> fetchrow_array();
45
- $sth -> finish;
46
- return $count || 0;
44
+ return Act::Data::talk_stars($self -> talk_id);
47
45
}
48
46
49
47
=head1 NAME
You can’t perform that action at this time.
0 commit comments