Skip to content

Commit

Permalink
fixed OConly notification; fixes #810
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Aug 29, 2015
1 parent 7d75591 commit f2c4ec4
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions htdocs/doc/sql/stored-proc/maintain-current.inc.php
Expand Up @@ -604,17 +604,15 @@
sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE, IN nType INT(1)) sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE, IN nType INT(1))
BEGIN BEGIN
/* type 1 = new cache, 2 = new OConly attribute */ /* type 1 = new cache, 2 = new OConly attribute */
IF (nType=1 OR INSERT IGNORE INTO `notify_waiting` (`cache_id`, `user_id`, `type`)
(nType=2 AND (SELECT `notify_oconly` FROM `user`,`caches` WHERE `user`.`user_id`=`caches`.`user_id` AND `caches`.`cache_id`=nCacheId))) THEN SELECT nCacheId, `user`.`user_id`, nType /* notify_new_cache */
INSERT IGNORE INTO `notify_waiting` (`cache_id`, `user_id`, `type`) FROM `user`
SELECT nCacheId, `user`.`user_id`, nType /* notify_new_cache */ /* Throttle email sending after undeliverable mails. See also runwatch.php. */
FROM `user` WHERE (`email_problems` = 0 OR DATEDIFF(NOW(),`last_email_problem`) > 1+DATEDIFF(`last_email_problem`,`first_email_problem`))
/* Throttle email sending after undeliverable mails. See also runwatch.php. */ AND (nType=1 OR `user`.`notify_oconly`)
WHERE (`email_problems` = 0 OR DATEDIFF(NOW(),`last_email_problem`) > 1+DATEDIFF(`last_email_problem`,`first_email_problem`)) AND `user`.`latitude`+`user`.`longitude` <> 0
AND `user`.`latitude`+`user`.`longitude` <> 0 AND `user`.`notify_radius`>0
AND `user`.`notify_radius`>0 AND (acos(cos((90-nLatitude) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) + sin((90-nLatitude) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos((nLongitude-`user`.`longitude`) * 3.14159 / 180)) * 6370) <= `user`.`notify_radius`;
AND (acos(cos((90-nLatitude) * 3.14159 / 180) * cos((90-`user`.`latitude`) * 3.14159 / 180) + sin((90-nLatitude) * 3.14159 / 180) * sin((90-`user`.`latitude`) * 3.14159 / 180) * cos((nLongitude-`user`.`longitude`) * 3.14159 / 180)) * 6370) <= `user`.`notify_radius`;
END IF;
END;"); END;");


// recreate the user statpic on next request // recreate the user statpic on next request
Expand Down

0 comments on commit f2c4ec4

Please sign in to comment.