Marc-Alexandre Chan  committed 3c5e144

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

  • Participants
  • Parent commits e59480a
  • Branches dev-minibot

Comments (0)

Files changed (1)

File minibot/

 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 =
-        # 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()).\
             q_local_date = self._localtime(q_time[0]).date()