fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-10-30 02:57 pm

[dw-free] self-expiring promo codes

[commit: http://hg.dwscoalition.org/dw-free/rev/b3ab77b750fd]

http://bugs.dwscoalition.org/show_bug.cgi?id=3386

Fix case when the promo code has no expiry date set (should always be usable
then). Aka: fu introduces a bug -- thanks [personal profile] exor674 for pointing
it out!

Patch by [personal profile] fu.

Files modified:
  • cgi-bin/DW/InviteCodes/Promo.pm
--------------------------------------------------------------------------------
diff -r e60d765b5519 -r b3ab77b750fd cgi-bin/DW/InviteCodes/Promo.pm
--- a/cgi-bin/DW/InviteCodes/Promo.pm	Fri Oct 28 19:41:12 2011 +0800
+++ b/cgi-bin/DW/InviteCodes/Promo.pm	Sun Oct 30 22:57:26 2011 +0800
@@ -113,7 +113,7 @@
     return 0 unless $self->{current_count} < $self->{max_count}; 
 
     # 0 for expiry_date means never expire;
-    return 0 unless $self->{expiry_date} && time() < $self->{expiry_date};
+    return 0 if $self->{expiry_date} && time() >= $self->{expiry_date};
     return 1;
 }
 
--------------------------------------------------------------------------------