Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send demo change emails unless anything meaningful changes #1097

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 24 additions & 20 deletions src/Classes/ServiceAPI/MyRadio_Demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,34 +119,38 @@ public function editDemo($time, $training_type, $max_participants, $link = null,
WHERE demo_id = $6",
[CoreUtils::getTimestamp($time), $link, $training_type, $signup_cutoff_hours, $max_participants, $this->getID()]
);
// Email People
$attendees = $this->myRadioUsersAttendingDemo();
$attendees[] = $this->getDemoer();

// Work out what to tell people re. where their training is
if ($link == null && $this->demo_link != null) {
$demo_location = "It is now in person at our studios in Vanbrugh College.";
} elseif ($link != null && $this->demo_link == null) {
$demo_location = "It is now online and will be hosted at " . $link;
} elseif ($link != null) {
$demo_location = "It will now be at " . $link;
} else {
$demo_location = "";
}

foreach ($attendees as $attendee) {
MyRadioEmail::sendEmailToUser(
$attendee,
"Updated Training Session",
"Hi " . $attendee->getFName()
if ($this->demo_time !== CoreUtils::getTimestamp($time) || $this->demo_link !== $link) {
// Email People
$attendees = $this->myRadioUsersAttendingDemo();
$attendees[] = $this->getDemoer();

// Work out what to tell people re. where their training is
if ($link == null && $this->demo_link != null) {
$demo_location = "It is now in person at our studios in Vanbrugh College.";
} elseif ($link != null && $this->demo_link == null) {
$demo_location = "It is now online and will be hosted at " . $link;
} elseif ($link != null) {
$demo_location = "It will now be at " . $link;
} else {
$demo_location = "";
}

foreach ($attendees as $attendee) {
MyRadioEmail::sendEmailToUser(
$attendee,
"Updated Training Session",
"Hi " . $attendee->getFName()
. "\r\n\r\n There's been a change to your training session on " . $this->demo_time
. ".\r\n\r\n"
. ($time != $this->demo_time ? "It is now at "
. CoreUtils::happyTime($time) . ".\r\n\r\n" : "")
. $demo_location . "\r\n\r\n"
. Config::$long_name . " Training Team"
);
);
}
}

$this->demo_link = $link;
$this->demo_time = CoreUtils::getTimestamp($time);
$this->presenterstatusid = $training_type;
Expand Down