Repository: RocketMap/RocketMap

Issue:
Expired lured pokestops are shown forever
<!--
  
  FOR FEATURE REQUESTS GO TO:
  
  http://feathub.com/PokemonGoMap/PokemonGo-Map/
  
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!
  ISSUES ARE NOT FOR SUPPORT!!!

  Join discord (channel: #help) for support at this link: https://discord.gg/PWp2bAm

-->

<!--- Provide a general summary of the issue in the Title above -->

Expired lured stops are shown as lured forever on the map
## Expected Behavior

<!--- If you're describing a bug, tell us what should happen -->

<!--- If you're suggesting a change/improvement, tell us how it should work -->

Lured stops should show as normal stops after expiring
## Current Behavior

<!--- If describing a bug, tell us what happens instead of the expected behavior -->

<!--- If suggesting a change/improvement, explain the difference from current behavior -->

Stops show as lured forever instead, with an `(expired)` after the expiry time
## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

<!--- or ideas how to implement the addition or change -->
## Steps to Reproduce (for bugs)

<!--- Provide a link to a live example, or an unambiguous set of steps to -->

<!--- reproduce this bug. Include code to reproduce, if relevant -->
1. Scan area with lured stop
2. Observe stop never goes back to being normal stop
## Context

<!--- How has this issue affected you? What are you trying to accomplish? -->

<!--- Providing context helps us come up with a solution that is most useful in the real world -->

Don't want all stops to show up as lured eventually.
## Your Environment

<!--- Include as many relevant details about the environment you experienced the bug in -->
- Version used: 7729aab526913db84b6e967c47e8c1c13828e125
- Environment name and version (e.g. Python 2.7): Docker image
- Operating System and version (desktop or mobile): Ubuntu server



Discussion:
If a pokestop does not disappear after "expired" is shown, try refreshing your browser and see if the pokestop have timer again. If it does, it means its a known bug since last pokestop update. You can refer and do a temporary fix as suggested in PR #555 which works up until now.

@clifford2006 Refreshing the browser doesn't change anything, they're still there and no timer appears. They just have text like `Lure expires at 09:41:29 (expired)` on all of them. I've been manually removing the lure with a sql query but I'm wondering why no one else has reported this bug before.

Cos I assumed it was part of the known issue he referenced, which it probably is.

I don't think this is related to that issue at all. It's not that the expiration times on the pokestops are wrong, it's that the expiration time passes and the `lure_expiration` column for that pokestop in the db is not being set back to `NULL` after.

@moussa probably something wrong with the latest commit since I'm just using the latest stable version v3.1.0  and nothing seems to go wrong up until now.


Resolving patch:
diff --git a/pogom/models.py b/pogom/models.py
--- a/pogom/models.py
+++ b/pogom/models.py
@@ -554,6 +554,12 @@ def clean_db_loop(args):
                             (datetime.utcnow() - timedelta(minutes=30)))))
             query.execute()
 
+            # Remove active modifier from expired lured pokestops
+            query = (Pokestop
+                     .update(lure_expiration=None)
+                     .where(Pokestop.lure_expiration < datetime.utcnow()))
+            query.execute()
+
             # If desired, clear old pokemon spawns
             if args.purge_data > 0:
                 query = (Pokemon


Test patch: