|
|
|
|
|
|
|
all-events-listing.html
<%init>
my $expire_cache_now=0;
use Data::Dumper;
use Date::Manip;
my $citydata=$m->comp ("/lib/data/city_standard.mas",city_standard_id=>17848);
my $events_by_year_month= $m->comp ("/lib/data/event_functions.mas",
%ARGS,
### look_ahead_window =>'2 months',
having_performances =>1,
city_standard_id =>17848,
method =>'eventMonthListing',
#### category=>12, ###### loading hot picks only
look_ahead_window_full_month =>'2 months',
exclude_event_category=>'{19}', ######## exclude poker events #########
event_category=> '{3}', ######## loading headliners events #########
exclude_ongoing=>1, ######## exclude ongoing events #########
order_by =>'min_date,name',
# DBG =>1,
expire_cache_now=>$expire_cache_now,
);
## behold the power of perl...
sub by_date{
my $date1 = ParseDate($a->{date_to_compare});
my $date2 = ParseDate($b->{date_to_compare});
my $flag=Date_Cmp($date1,$date2);
return $flag
} ##end by_date
my $combined_events_by_month_year;
for my $year_month(@{$events_by_year_month}){
my @event_performances_combined;
for my $event(@{$year_month->{event_list} }){
## when a sporting event, map all data from structs(event and performance refs) onto one struct(a pseudo-event)
if ($event->{type_name}=~/sports/i){
my $performances= $m->comp ("/lib/data/event_functions.mas",
event_id=>$event->{id},
min_date=>$event->{min_date},
max_date=>$event->{max_date},
city_standard_id =>17848,
method =>'performanceListing',
);
for my $performance(@{$performances}){
my $struct;
$struct->{date_to_compare}=$performance->{fmt_date};
map {$struct->{$_}=$performance->{$_}} keys %{$performance};
map {$struct->{$_}=$event->{$_}} keys %{$event};
push @event_performances_combined,$struct;
} ##end for
} ##end if
else{
## non sporting event
my $performances= $m->comp ("/lib/data/event_functions.mas",
event_id=>$event->{id},
date=>$event->{min_date},
method =>'performanceListing',
city_standard_id =>17848,
limit =>1,
# DBG =>1,
);
$performances=$performances->[0];
$event->{date_to_compare}=$event->{min_date};
$event->{venue_id}=$performances->{venue_id};
$event->{venue_name}=$performances->{venue_name};
push @event_performances_combined,$event;
} ##end else
} ##end for
## at this point we have all the data, now lets sort it by either min_date or fmt_date
@event_performances_combined=sort by_date @event_performances_combined;
my $combined_year_month;
map {$combined_year_month->{$_}=$year_month->{$_} } keys %{$year_month};
$combined_year_month->{event_list}=\@event_performances_combined;
push @{$combined_events_by_month_year},$combined_year_month;
} ##end for
## ******************* rule of thumb for this page *******************
## use the documentations returned variables is this way:
## any sports will have the event AND performance variables available
## not sports will have only the event variables
%init>
|
|
|