From 2b9520a193f73897c825cc7d9434705805d1a829 Mon Sep 17 00:00:00 2001
From: Tyler Lemburg <trlemburg@gmail.com>
Date: Thu, 3 Nov 2016 16:17:12 -0500
Subject: [PATCH] Change daily digest conditions for creative email

After making this AWESOME email script to let people know when lockups
were awaiting approval, Marcelo said he'd rather only get emails AFTER the
communicator had approved the lockup.
---
 scripts/daily_digest.php | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/scripts/daily_digest.php b/scripts/daily_digest.php
index b6175e38..909835d5 100644
--- a/scripts/daily_digest.php
+++ b/scripts/daily_digest.php
@@ -38,19 +38,16 @@ UNL Lockup Factory
 ';
 
 		Emailer::sendMail($approver->email, "UNL Lockup Factory Digest", $body);
-		echo 'sent mail to ' . $approver->email;
-		echo $body;
 	}
 }
 
 # also do this for creative
 $creative_emails = array('mplioplis2@unl.edu'); # configurable value
 
-# find all lockups that they have that are awaiting communicator approval 
-# (that were generated in the last 24 hours)
+# find all lockups that they have that are awaiting creative approval
 $lockups = Lockup::find('all', array('conditions' => 
-	array('creative_status = ? AND date_created >= ?', 'awaiting_approval', 
-	date('Y-m-d H:i:s', time() - 24*60*60))));
+	array('creative_status = ? AND status = ?', 
+		'awaiting_approval', 'approved')));
 
 # send an email if there is at least 1 of these
 if (count($lockups) > 0) {
@@ -70,6 +67,4 @@ UNL Lockup Factory
 ';
 
 	Emailer::sendMail($creative_emails, "UNL Lockup Factory Digest", $body);
-	echo 'sent mail to creative';
-	echo $body;
 }
-- 
GitLab