Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explorer cluster and square detection broken #161

Closed
martin-ueding opened this issue Sep 10, 2024 · 1 comment
Closed

Explorer cluster and square detection broken #161

martin-ueding opened this issue Sep 10, 2024 · 1 comment
Labels
component: core Activity management, explorer tiles type: bug Something isn't working

Comments

@martin-ueding
Copy link
Owner

With the latest changes to the tile handling stuff, the cluster detection is now broken:

image

@martin-ueding martin-ueding added type: bug Something isn't working component: core Activity management, explorer tiles labels Sep 10, 2024
@martin-ueding
Copy link
Owner Author

I've looked at one particular tile:

Bildschirmfoto_20240919_070334

And it seems to be missing from the tile history:

>>> import pickle
>>> with open("/home/mu/Dokumente/Karten/Playground/Cache/tile-state-2.pickle", 'rb') as f: data = pickle.load(f)
...
>>> th = data['tile_history'][14]
>>> th.loc[th.tile_x == 8513]
            activity_id                    time  tile_x  tile_y  count
2    605600879631349435 2013-03-26 14:16:28.000    8513    5509      5
3    605600879631349435 2013-03-26 14:16:38.000    8513    5508      6
...
>>> th.loc[(th.tile_x == 8513) & (th.tile_y == 5514)]
Empty DataFrame
Columns: [activity_id, time, tile_x, tile_y, count]
Index: []

So there is a problem with the tile_history feature, not all tiles gets inserted there. But we can see that the tile is shown as discovered. In the tile_visits it is present:

>>> tv = data['tile_visits'][14]
>>> tv[(8513, 5514)]
{'activity_ids': {3280749438695665022}, 'first_id': 3280749438695665022, 'first_time': Timestamp('2022-07-23 14:19:48'), 'last_id': 3280749438695665022, 'last_time': Timestamp('2022-07-23 14:19:48')}

Ah, it breaks when there was an activity there which we did not consider for achievements:

            if activity["consider_for_achievements"]:
                if tile not in activities_per_tile:
                    new_tile_history_soa["activity_id"].append(activity_id)
                    new_tile_history_soa["time"].append(time)
                    new_tile_history_soa["tile_x"].append(tile[0])
                    new_tile_history_soa["tile_y"].append(tile[1])

            activities_per_tile[tile].add(activity_id)

So I just need to use a different basis to check, using tile_state["tile_visits"][zoom] instead of activities_per_tile only considers the activities for achievements.

And with that change it is now fixed:

Bildschirmfoto_20240919_071107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: core Activity management, explorer tiles type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant