« lib/Video/PlaybackMachine/FillSegment.pm
↑ Summary
lib/Video/PlaybackMachine/FillProducer/AbstractStill.pm »
| 1 | package Video::PlaybackMachine::Schema::Result::Schedule; | ||
| 2 | |||
| 3 | 3 | our $VERSION = '0.09'; # VERSION | |
| 4 | |||
| 5 | 3 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 3 | ▶ | use base 'DBIx::Class::Core'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | __PACKAGE__->table('schedule'); | |
| 11 | |||
| 12 | 3 | __PACKAGE__->add_columns( | |
| 13 | 'schedule_id' => { data_type => 'integer', is_nullable => 0}, | ||
| 14 | 'name' => { data_type => 'text', is_nullable => 0 } | ||
| 15 | ); | ||
| 16 | |||
| 17 | 3 | __PACKAGE__->set_primary_key('schedule_id'); | |
| 18 | |||
| 19 | 3 | __PACKAGE__->add_unique_constraint(['name']); | |
| 20 | |||
| 21 | 3 | __PACKAGE__->has_many( | |
| 22 | 'schedule_entries', | ||
| 23 | 'Video::PlaybackMachine::Schema::Result::ScheduleEntry', | ||
| 24 | { 'foreign.schedule_id' => 'self.schedule_id' }, | ||
| 25 | { cascade_copy => 1, cascade_delete => 1 }, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 0 | ▶ | sub schedule_entries_in_order { |
|
Subroutine
schedule_entries_in_order: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 29 | 0 | my $self = shift; | |
| 30 | |||
| 31 | 0 | return $self->search_related('schedule_entries', {}, { 'order_by' => 'start_time' }); | |
| 32 | } | ||
| 33 | |||
| 34 | 0 | ▶ | sub movie_conflicts { |
|
Subroutine
movie_conflicts: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 35 | 0 | my $self = shift; | |
| 36 | 0 | my ($new_start, $duration) = @_; | |
| 37 | |||
| 38 | 0 | my $new_stop = $new_start + $duration; | |
| 39 | |||
| 40 | 0 | return $self->search_related('schedule_entries', | |
| 41 | [ | ||
| 42 | { | ||
| 43 | '-and' => | ||
| 44 | [ 'start_time' => { '>=', $new_start }, | ||
| 45 | 'start_time' => { '<=', $new_stop } | ||
| 46 | ] | ||
| 47 | }, | ||
| 48 | { | ||
| 49 | 'start_time' => { '<=', $new_start }, | ||
| 50 | 'schedule_entry_end.stop_time' => { '>=', $new_start } | ||
| 51 | } | ||
| 52 | ], | ||
| 53 | { | ||
| 54 | join => 'schedule_entry_end' | ||
| 55 | } | ||
| 56 | ); | ||
| 57 | }; | ||
| 58 | |||
| 59 | 3 | 1; | |