Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Displaying Pokestops + LuredPokestops #362

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Unknown66
Copy link

@Unknown66 Unknown66 commented Aug 23, 2016

Displaying Pokestops + LuredPokestops. (lure_expiration data only for next 3 minutes available.)

Lured will be showed too. (lure_expiration data only for next 3 minutes available)
This was referenced Aug 23, 2016
@Korzakov
Copy link

Very nice work! Please merge this!

@djv2
Copy link

djv2 commented Aug 25, 2016

does this display the lured pokemon from the lured stop?

@RafaelKaczmarczyk
Copy link

Tested it! Very good work!

@Made123
Copy link

Made123 commented Aug 29, 2016

@Unknown66 Why does the lure expiration time shows only the next 3 minutes and not his final time expiration ?

And i can see that the lures pokemons are not shown.

@luzannew luzannew mentioned this pull request Aug 29, 2016
@M3G4THEKING
Copy link

I have try this but is not 100% accure pokèstop lures,but shows all pokèstops,thanks for improvement.

@gatomiaurex
Copy link

Using this breaks the ability to hide pokemons, it breaks the box to type the name and the ability to click on them and hide them manually.

This is also missing a switch to show only lured pokestops.

untitled

@smartcuc
Copy link

Well, by using the last version with db-support, lured PS are only shown for 2-3 minute.
@gatomiaurex : display is working on all browsers I have tested. Maybe you meshed something up.

@Unknown66
Copy link
Author

Don't know why there's only data for the next 3minutes. There's possibly something wrong with the calculated date inside the db.

@@ -42,6 +42,7 @@ function pad(num, size) {
document.getElementById('pokemon-checkbox').checked = getFromStorage("displayPokemons", "true");
document.getElementById('gyms-checkbox').checked = getFromStorage("displayGyms", "true");
document.getElementById('coverage-checkbox').checked = getFromStorage("displayCoverage", "true");
document.getElementById('pokestops-checkbox').checked = getFromStorage("displayPokestops", true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change true to "true", it doesn't get recognized so the pokestops are not displayed by default.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it better to use true or false instead of "true"?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but currently it doesn't work if you use booleans.

Copy link

@smartcuc smartcuc Sep 1, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I'm using the last version and it's working pretty well (Python 2.7.x)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true is the right expression there.
But the option pokestops inside app.py was set to false as default. (for case: not specified in request)

Default is now don't Display-pokestops.

@smartcuc
Copy link

smartcuc commented Aug 31, 2016

Could it be that there is something wrong in the models.py (line 172 - 193)? Once the pokestop has been seen in lure, within the next scan cycle 'lure_expiration' is set to NULL in the db as well as active_pokemon_id. Either setting l_e and a_p_ip to NULL or the math could be a problem.

| last_modified | lure_expiration | active_pokemon_id |
+---------------------+---------------------+-------------------+
| 2016-08-31 19:31:06 | 2016-08-31 19:34:06 | 21 |
+---------------------+---------------------+-------------------+

8 minutes later:
| 2016-08-31 19:31:06 | 2016-08-31 19:40:06 | 10 |

8 minutes later:
| 2016-08-31 19:31:06 | 2016-08-31 19:49:06 | 13 |

5 minutes later:
| 2016-08-31 19:31:06 | 2016-08-31 19:52:06 | 16 |

4 minutes later:
| 2016-08-31 19:31:06 | 2016-08-31 19:55:06 | 13 |

lure_expiration and active_pokemon_id are NULL between they show up again.

@smartcuc
Copy link

smartcuc commented Sep 2, 2016

Ok. @Unknown66: Your code seems to be right.
The issue is in models.py (lines 177, 179 and 180 ).
lure_info is not everytime part of f. So, 'active_fort_modifier' would be a better indicator for lure state or not.

2016-09-03 01:40:56,252 [ models] [INFO] {'last_modified_timestamp_ms': 1472858303738L, 'enabled': True, 'longitude': 6.988225, 'active_fort_modifier': [501], 'latitude': 50.815297, 'type': 1, 'id': u'ea54118027fb460ab6217c20dcf405bf.16'}

@smartcuc
Copy link

smartcuc commented Sep 3, 2016

Got it, at least a quick fix:
pogom/models.py:
line 9:
from datetime import datetime timedelta

line 176:

        if f.get('type') == 1:  # Pokestops
            if 'active_fort_modifier' in f:
                lure_expiration = datetime.utcfromtimestamp(
                        f['last_modified_timestamp_ms'] / 1000.0) + timedelta(minutes=30)
                active_pokemon_id = 21 # Jut temp. Need more investigation.
            else:
                lure_expiration, active_pokemon_id = None, None

@Unknown66
Copy link
Author

Unknown66 commented Sep 3, 2016

Seems like you got an older version of this one. In current master its not a temp pokemon_id anymore.

@smartcuc
Copy link

smartcuc commented Sep 3, 2016

It should display lured pokestops and remaining time as well. Today’s test was successful.

@smartcuc
Copy link

smartcuc commented Sep 3, 2016

Got it. When you want to catch the lured pokemons, add an if / else with new fields beginning at line 180 with your if 'lure_info' in f: code. Best would be to extend or a new the base model for this.

@Unknown66
Copy link
Author

We've only got to return pokemon inside model.py if pokestop is lured.
Then it should work. Therefor another query inside Pokemon.get_active should be enough.

@smartcuc
Copy link

smartcuc commented Sep 4, 2016

Here we go with a diff. It displays on the map:

  • Pokestops
  • Lured Pokestops with remaining
  • Lured Pokémons with remaining time (always ~3 minutes)

models.dff.txt

@smartcuc
Copy link

smartcuc commented Sep 4, 2016

...and the models.py renamed to .txt for upload....
models.py.txt

Before it gets lost:
There maybe is the need to add the on or other meter / inch to the lured pokemon to avoid overlap with a second lured pokemon.

@smartcuc
Copy link

smartcuc commented Sep 4, 2016

Is there a way to get and show the picture of the pokestops?

@Unknown66
Copy link
Author

Unknown66 commented Sep 4, 2016

Mhh dont know if: + timedelta(minutes=30) is a good idea.
If you scan a lured pokestop lets say 5min before deactivation you would think it remains for about 30min.

And another thought. pokemons['encounter_id'] should be pokemons[f['lure_info']['encounter_id']] else you would only overwrite the entry 'encounter_ID' inside the dict.

Please correct me if I missed something.

@smartcuc
Copy link

smartcuc commented Sep 5, 2016

Well, maybe I'm wrong, but my understanding is that 'last_modified_timestamp_ms' is the time, when the pokestop has been switched into lure mode. Lure expiration should be 30 minutes later. Even when the scan is detecting the lured pokestop 5min before deactivation, the timestamp is still valid and lure will expire in 5min.

Updated pokemons['encounter_id'] to pokemons[f['lure_info']['encounter_id']] .

Many thanks!!!!

@Unknown66
Copy link
Author

Unknown66 commented Sep 5, 2016

Checked it. You're right last_modified_timestamp_ms is the the time from lure!
And lure_expiration seems to be the time when the pokemon is gone. (But its only 3min in the future and sometimes the pokemon_id don't change)

Will change my code this evening! Thanks for your help 👍

@djv2
Copy link

djv2 commented Sep 5, 2016

@smartcuc can you make a separate PR with your changes? i have yet to getting any working lured pokestop/pokemon working

@Unknown66 Unknown66 changed the title Displaying pokestops. Displaying Pokestops + LuredPokestops. Sep 5, 2016
@Unknown66 Unknown66 changed the title Displaying Pokestops + LuredPokestops. Displaying Pokestops + LuredPokestops Sep 5, 2016
@@ -42,6 +42,7 @@ function pad(num, size) {
document.getElementById('pokemon-checkbox').checked = getFromStorage("displayPokemons", "true");
document.getElementById('gyms-checkbox').checked = getFromStorage("displayGyms", "true");
document.getElementById('coverage-checkbox').checked = getFromStorage("displayCoverage", "true");
document.getElementById('pokestops-checkbox').checked = getFromStorage("displayPokestops", false);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is still incorrect, shouldn't it be the "false" string instead of a boolean? Just basing off from the code above.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, line 45 looks fine to me Line 42, 43 and 44 should be true instead of "true".

@Unknown66
Copy link
Author

Unknown66 commented Sep 6, 2016

The other lines are wrong.
The wrong behaviour came from static/app.py line 173:
if request.args.get('pokestops', 'false') == 'true':

Forgot the write this yesterday..

@Unknown66
Copy link
Author

#375 fine to use with this to have less traffic. (pokestops need much traffic in citys)

@M3G4THEKING
Copy link

I dont if someone have the same issue but for only show this http://prntscr.com/cp2ym8 .

@Unknown66
Copy link
Author

That is normal!
The 2nd line is the unique ID of the pokestop (real name would issue another API Call).
The third line tells you the time when the lure module ends.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants