Commits

Marc-Alexandre Chan committed 3c5e144

Fixed bug where AddPromptCommand auto date detection fails if prompts all posted

Comments (0)

Files changed (1)

 
 import praw.objects
 
+from sqlalchemy import or_
 from sqlalchemy.sql import desc
 
 from datetime import datetime, timedelta, time as dt_time, date as dt_date
         a_day = timedelta(days=1)
         # get today, local time
         current_date = datetime.now().date()
-        # iterate queued prompts for the future
+        # iterate queued/posted prompts for the future
         for q_time in db.query(Prompt.post_time).\
-                      filter(Prompt.status == Prompt.STATUS_QUEUED).\
+                      filter(or_(Prompt.status == Prompt.STATUS_QUEUED,
+                                Prompt.status == Prompt.STATUS_POSTED)).\
                       filter(Prompt.post_time >= datetime.utcnow()).\
                       order_by(Prompt.post_time):
             q_local_date = self._localtime(q_time[0]).date()