aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-10-19 11:05:04 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:29:20 +0000
commitbc19b9e00f3d59a2f0694f2fcc3aab54fef35e9e (patch)
tree0d94dd0934cc237d6fa02cc98db6d2a5527f8ff9 /perllib/FixMyStreet
parentc0f9b0dcb1fc7cecb4b98ad82715600f73707bf0 (diff)
[Bromley] ICal generation.
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 6441180e3..ed96eb1bb 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -561,5 +561,33 @@ sub _parse_schedules {
};
}
+sub bin_future_collections {
+ my $self = shift;
+
+ my $services = $self->{c}->stash->{service_data};
+ my @tasks;
+ my %names;
+ foreach (@$services) {
+ push @tasks, $_->{service_task_id};
+ $names{$_->{service_task_id}} = $_->{service_name};
+ }
+
+ my $echo = $self->feature('echo');
+ $echo = Integrations::Echo->new(%$echo);
+ my $result = $echo->GetServiceTaskInstances(@tasks);
+
+ my $events = [];
+ foreach (@$result) {
+ my $task_id = $_->{ServiceTaskRef}{Value}{anyType};
+ my $tasks = Integrations::Echo::force_arrayref($_->{Instances}, 'ScheduledTaskInfo');
+ foreach (@$tasks) {
+ my $dt = construct_bin_date($_->{CurrentScheduledDate});
+ my $summary = $names{$task_id} . ' collection';
+ my $desc = '';
+ push @$events, { date => $dt, summary => $summary, desc => $desc };
+ }
+ }
+ return $events;
+}
1;