×
To be able to write in the forum you need to authenticate. Meanwhile it's read-only.
Labcaches
I will release two updates to the Sandbox API in a few minutes.
Both implementations are 100% untested. Feel free to test them, if they don't work, please inform me here.
None of them are documented yet. I will generate a new Doxygen documentation when I know that they work.
New method PGC.GetLabCacheFinds(profileId)
Doxygen basis
New in-parameter to PGC.GetFinds()
The implementation first fetches all geocache finds as before. When that process is done it fetches the labcache finds and append those.
After that it sorts the data again. We do not have data to sort labcaches and geocaches within the same day correctly. Geocaches will still be sorted correctly, but all the Labcache finds will be at the end of that day.
If a limit has been provided, we will slice the data array down to the limit again.
Edited 1 time(s). Last edit at 01/15/2020 11:13AM by magma1447. (view changes)
Both implementations are 100% untested. Feel free to test them, if they don't work, please inform me here.
None of them are documented yet. I will generate a new Doxygen documentation when I know that they work.
New method PGC.GetLabCacheFinds(profileId)
Doxygen basis
/// @brief Returns an associative array with the labcache finds from given profileId. /// /// Returned fields: guid, name, date_found /// @param[in] int $profileId An integer with the users profile id.
New in-parameter to PGC.GetFinds()
/// - includeLabCaches (bool): If set to true, will include labcache finds. Note that most fields returned will be null.If used, the data with Geocache finds will be merged with Labcache finds. It's a hack though. All fields except those mentioned here will be set to NULL. The LUA script must be able to handle that.
- cache_id - Will be set to crc32 of a GUID string.
- gccode - Will be set to the GUID of the Labcache. Example: 0008be86-1cf0-49b3-8b21-a9aa17bac1a2
- cache_name - The name of the labcache.
- visitdate - Date logged.
The implementation first fetches all geocache finds as before. When that process is done it fetches the labcache finds and append those.
After that it sorts the data again. We do not have data to sort labcaches and geocaches within the same day correctly. Geocaches will still be sorted correctly, but all the Labcache finds will be at the end of that day.
If a limit has been provided, we will slice the data array down to the limit again.
Edited 1 time(s). Last edit at 01/15/2020 11:13AM by magma1447. (view changes)
Re: Labcaches January 15, 2020 05:18PM |
Registered: 5 years ago Posts: 4,125 |
Re: Labcaches January 15, 2020 05:27PM |
Admin Registered: 7 years ago Posts: 772 |
pieterix Wrote:
-------------------------------------------------------
> I assume it's not deployed yet?
>
> Caught exception: attempt to call field
> 'GetLabCacheFinds' (a nil value)
It is, but I forgot to add the method into the Sandbox, I just wrote the code... I should have tested it myself. I will attack it tomorrow, and at least test that it gives decent data.
-------------------------------------------------------
> I assume it's not deployed yet?
>
> Caught exception: attempt to call field
> 'GetLabCacheFinds' (a nil value)
It is, but I forgot to add the method into the Sandbox, I just wrote the code... I should have tested it myself. I will attack it tomorrow, and at least test that it gives decent data.
Re: Labcaches January 15, 2020 06:13PM |
Admin Registered: 7 years ago Posts: 772 |
It's fixed now, and I made a new release.
I have tested method GetLabCacheFinds(). It seems to return relevant data.
I tested GetFinds() so that it actually runs. I did not verify that I got the data I expected. So if you do not find any labcaches here, it probably doesn't work.
Regarding GetFinds() I added these two comments:
* The field cache_id is NOT guaranteed to be unique between geocaches and labcaches.
* Filters are ignored, even for dates.
If parameter includeLabCaches = true is set, it will return ALL LabCaches finds for that user, regardless of filters. Also note that the script can not rely on the cache_id being unique. The GC-code will be however, since it's either a GC-Code or a long GUID. As the data is today, there are 34 collisions between cache_id (int) and crc32(labcache-guid).
I have tested method GetLabCacheFinds(). It seems to return relevant data.
I tested GetFinds() so that it actually runs. I did not verify that I got the data I expected. So if you do not find any labcaches here, it probably doesn't work.
Regarding GetFinds() I added these two comments:
* The field cache_id is NOT guaranteed to be unique between geocaches and labcaches.
* Filters are ignored, even for dates.
If parameter includeLabCaches = true is set, it will return ALL LabCaches finds for that user, regardless of filters. Also note that the script can not rely on the cache_id being unique. The GC-code will be however, since it's either a GC-Code or a long GUID. As the data is today, there are 34 collisions between cache_id (int) and crc32(labcache-guid).
Re: Labcaches January 15, 2020 06:15PM |
Registered: 5 years ago Posts: 4,125 |
Re: Labcaches March 03, 2020 12:21PM |
Registered: 4 years ago Posts: 315 |
I'm having trouble with GetFinds. Doing
seems to set finds to true, instead of a table for some reason. I thought the fields/filters might mess it up somehow, and indeed with
the result is a table at least, however it still does not include Labs.
Edited 1 time(s). Last edit at 03/03/2020 12:22PM by PattuX. (view changes)
local finds = PGC.GetFinds(profileId, { includeLabCaches = true, fields = {'gccode', 'cache_name', 'visitdate','type', 'country'}, order = 'OLDESTFIRST', filter = filter })
seems to set finds to true, instead of a table for some reason. I thought the fields/filters might mess it up somehow, and indeed with
local finds = PGC.GetFinds(profileId, { includeLabCaches = true })
the result is a table at least, however it still does not include Labs.
Edited 1 time(s). Last edit at 03/03/2020 12:22PM by PattuX. (view changes)
Re: Labcaches March 04, 2020 08:29AM |
Admin Registered: 7 years ago Posts: 772 |
Re: Labcaches March 04, 2020 12:07PM |
Admin Registered: 7 years ago Posts: 772 |
Found a sloppy error. After adding the Labcaches I need to re-sort the data. The code did a $data = uasort(...); But PHP's uasort() doesn't return the result, the parameter for the data is a reference, so it's sorted in-place. $data was set to TRUE because the sort was successful. I of course know that uasort() doesn't return the result, so it was surprising to find the error.
I will make a new release with the fix in a few minutes. I still haven't tested the code. If it still doesn't work, could you provide me with a link to a fairly simple LUA script which shows the issue?
I will make a new release with the fix in a few minutes. I still haven't tested the code. If it still doesn't work, could you provide me with a link to a fairly simple LUA script which shows the issue?
Re: Labcaches March 04, 2020 09:32PM |
Registered: 4 years ago Posts: 315 |
https://project-gc.com/Challenges//46972
Edited 1 time(s). Last edit at 03/04/2020 09:33PM by PattuX. (view changes)
local finds = PGC.GetFinds(profileId, { includeLabCaches = true })works correctly.
PGC.GetFinds(profileId, { includeLabCaches = true, fields = {'gccode', 'cache_name', 'visitdate','type', 'country'}, order = 'OLDESTFIRST', filter = filter })however results in some backend error (see checker). Specifically, the order parameter. Without it, it works fine.
Edited 1 time(s). Last edit at 03/04/2020 09:33PM by PattuX. (view changes)
Re: Labcaches March 04, 2020 11:15PM |
Registered: 6 years ago Posts: 32 |
Hi Pattux, it looks interesting:)-D, but I could not get it working yet. Would you make a calender matrix checker for lab caches? It should look like this one https://project-gc.com/Challenges/GC7GQTV/31113
Re: Labcaches March 05, 2020 11:12AM |
Registered: 4 years ago Posts: 315 |
Such a challenge would surely not be published, see rule 10 of the guidelines.
I find "specifying" a bit vague, but I think it's fine to allow Lab Caches to count towards a challenge (i.e. as one type in "Find 100 caches for each of 7 types", or one date in "find a cache on each calendar date") but not to make them mandatory.
Also please use the Checker requests forum for checker requests.
Quote
Not allowed: Trackable, Benchmarking, Waymarking logs, or specifying Lab Cache finds.
I find "specifying" a bit vague, but I think it's fine to allow Lab Caches to count towards a challenge (i.e. as one type in "Find 100 caches for each of 7 types", or one date in "find a cache on each calendar date") but not to make them mandatory.
Also please use the Checker requests forum for checker requests.
Re: Labcaches March 05, 2020 12:37PM |
Registered: 6 years ago Posts: 32 |
I was just curious wether it is really possible with your script or not. Would be fun to see, since U was not able to get your https://project-gc.com/Challenges//46972 working yet
Re: Labcaches March 05, 2020 01:50PM |
Registered: 4 years ago Posts: 315 |
Re: Labcaches March 06, 2020 10:20AM |
Admin Registered: 7 years ago Posts: 772 |
PattuX Wrote:
-------------------------------------------------------
> https://project-gc.com/Challenges//46972
>
>
>
>
> e checker). Specifically, the order parameter.
> Without it, it works fine.
Thank you for the script, most helpful.
I have found three issues, and corrected them in the development environment. I am aiming for a new release before 3 pm CET today. Could also be within an hour. Just have some other things to cleanup first.
Issue 1) When specifying fields, some fields are always added even though you don't request them. Those are fields used by the code. The log_id is required for the re-sort after adding Labcaches, but it was missing in the list of always-add-fields. Therefore you got the errors you got.
Issue 2) Type wasn't set to anything. It will from now on be set to *Labcache* (no stars).
Issue 3) Fields that doesn't exist for labcaches, should be filled with NULL. The callback has a mapping between field names and database column names, with table prefixes. Instead of setting for example log_id to NULL, I was setting l.log_id to NULL. I was using the value in the table instead of the key.
Conclusion: I need to trust myself less when changing the LUA callbacks. Seems like I more often get it wrong than right. At least I did say it was untested this time. :)
Typical example of a row from a labcache when fiels isn't specified:
I hope it works better for you now. I couldn't see anything else that's weird.
-------------------------------------------------------
> https://project-gc.com/Challenges//46972
>
>
> local finds = PGC.GetFinds(profileId, { > includeLabCaches = true }) >> works correctly.
>
>
> PGC.GetFinds(profileId, { includeLabCaches = true, > fields = {'gccode', 'cache_name', > 'visitdate','type', 'country'}, order = > 'OLDESTFIRST', filter = filter }) >> however results in some backend error (see
> e checker). Specifically, the order parameter.
> Without it, it works fine.
Thank you for the script, most helpful.
I have found three issues, and corrected them in the development environment. I am aiming for a new release before 3 pm CET today. Could also be within an hour. Just have some other things to cleanup first.
Issue 1) When specifying fields, some fields are always added even though you don't request them. Those are fields used by the code. The log_id is required for the re-sort after adding Labcaches, but it was missing in the list of always-add-fields. Therefore you got the errors you got.
Issue 2) Type wasn't set to anything. It will from now on be set to *Labcache* (no stars).
Issue 3) Fields that doesn't exist for labcaches, should be filled with NULL. The callback has a mapping between field names and database column names, with table prefixes. Instead of setting for example log_id to NULL, I was setting l.log_id to NULL. I was using the value in the table instead of the key.
Conclusion: I need to trust myself less when changing the LUA callbacks. Seems like I more often get it wrong than right. At least I did say it was untested this time. :)
Typical example of a row from a labcache when fiels isn't specified:
'gccode' => 'e71611de-13a8-42c3-8b66-879021f7bae4', 'cache_id' => 1157519609, 'cache_name' => 'Adventure 10 - Find the image', 'type' => 'Labcache', 'difficulty' => NULL, 'terrain' => NULL, 'size' => NULL, 'owner_id' => NULL, 'placed_by' => NULL, 'latitude' => NULL, 'longitude' => NULL, 'elevation' => NULL, 'hidden' => NULL, 'last_publish_date' => NULL, 'country' => NULL, 'region' => NULL, 'county' => NULL, 'archived' => NULL, 'disabled' => NULL, 'premium' => NULL, 'last_find_date' => NULL, 'last_archive_date' => NULL, 'num_finds' => NULL, 'latest_logs' => NULL, 'favorite_points' => NULL, 'favorite_points_pct' => NULL, 'favorite_points_wilson' => NULL, 'last_cache_harvest' => NULL, 'last_log_harvest' => NULL, 'log_id' => NULL, 'visitdate' => '2020-01-27', 'length' => NULL, 'words' => NULL, 'attributes_set_1' => NULL, 'attributes_set_2' => NULL, 'attributes_unset_1' => NULL, 'attributes_unset_2' => NULL,
I hope it works better for you now. I couldn't see anything else that's weird.
Re: Labcaches March 06, 2020 11:40AM |
Registered: 4 years ago Posts: 315 |
Re: Labcaches March 06, 2020 11:44AM |
Admin Registered: 7 years ago Posts: 772 |
Re: Labcaches March 06, 2020 12:27PM |
Admin Registered: 7 years ago Posts: 772 |
Re: Labcaches March 06, 2020 01:27PM |
Registered: 4 years ago Posts: 315 |
Re: Labcaches March 08, 2020 08:53AM |
Registered: 6 years ago Posts: 32 |
Ok, thank you for your effort Pattux and Magma1447, I could use your challenge checker now too, however I am still having problems with this issue:
This multi cache calender checker https://project-gc.com/Challenges/GC7GQTV/31113 uses this source: Generic calendar checker, by pinkunicorn
It displays every calendar day with a multi cache find in a nice looking table.
The decision, that multi caches are to be checked is made not by the source but with the tag config. I was able to change it from multi cache calender checker to traditional cache calender checker by changing the word multi cache into traditional cache in the tag config. However, changing it into Lab Cache does not show any finds, even though I definitely have found la caches on several days. In the source of Generic calendar checker there are lab caches mentioned with all the other caches, there is a lab cache icon with all the other icons, so I can not find the mistake.
This multi cache calender checker https://project-gc.com/Challenges/GC7GQTV/31113 uses this source: Generic calendar checker, by pinkunicorn
It displays every calendar day with a multi cache find in a nice looking table.
The decision, that multi caches are to be checked is made not by the source but with the tag config. I was able to change it from multi cache calender checker to traditional cache calender checker by changing the word multi cache into traditional cache in the tag config. However, changing it into Lab Cache does not show any finds, even though I definitely have found la caches on several days. In the source of Generic calendar checker there are lab caches mentioned with all the other caches, there is a lab cache icon with all the other icons, so I can not find the mistake.
Re: Labcaches March 08, 2020 08:57AM |
Admin Registered: 7 years ago Posts: 772 |
That script doesn't support Lab Caches, like most aren't. It just happens to have a copy/paste-block with the name and an icon. It's not fetching Lab caches from the API for example.
There probably aren't many active scripts handling Lab caches, probably even fewer that hasn't been created this year, if any.
There probably aren't many active scripts handling Lab caches, probably even fewer that hasn't been created this year, if any.
Re: Labcaches March 08, 2020 09:13AM |
Registered: 6 years ago Posts: 32 |
Re: Labcaches August 13, 2020 09:20AM |
Registered: 7 years ago Posts: 39 |
Re: Labcaches March 08, 2020 09:17AM |
Admin Registered: 7 years ago Posts: 772 |
I don't think this thread is the right place for that discussions. But since it's possible to write such script, it's possible to change the script into handling it.
I can't answer for how hard it is since I don't know the script. It can possibly have unintended side-effects on other features in the script. It could very well be smarter to create a new script, that does what you want, therefore requesting a check could be more wise. I am personally for many small script that fills few purposes rather than gigantic unreadable scripts that does everything.
I can't answer for how hard it is since I don't know the script. It can possibly have unintended side-effects on other features in the script. It could very well be smarter to create a new script, that does what you want, therefore requesting a check could be more wise. I am personally for many small script that fills few purposes rather than gigantic unreadable scripts that does everything.
Re: Labcaches March 08, 2020 03:24PM |
Registered: 6 years ago Posts: 32 |
Re: Labcaches March 12, 2020 05:05AM |
Registered: 7 years ago Posts: 1,814 |
Re: Labcaches August 13, 2020 09:31AM |
Registered: 5 years ago Posts: 4,125 |
Given HQ's apparent drive to add more Adventure Lab caches, are there any changes in the pipeline on the information that Project-GC receives from HQ regarding them? I seem to recall (and I can't find the thread where this was mentioned) that PGC receives almost no information on them, eg. no owner, coordinates, etc.
Re: Labcaches August 13, 2020 09:39AM |
Admin Registered: 7 years ago Posts: 772 |
I can't find that post either, even though I actually saw it this morning. I know I posted the DB schema definitions of the tables.
There currently are no changes. I hope to be able to get the owner of them in the future, and maybe even coordinates. I don't know if they have coordinates for all or just some. Also, I don't know how relevant the coordinates actually are.
Also, is there actually any of this information that would be relevant for challenges? I doubt it, at least with current guidelines. You are not even allowed to create a challenge that requires you to log a lab cache.
There currently are no changes. I hope to be able to get the owner of them in the future, and maybe even coordinates. I don't know if they have coordinates for all or just some. Also, I don't know how relevant the coordinates actually are.
Also, is there actually any of this information that would be relevant for challenges? I doubt it, at least with current guidelines. You are not even allowed to create a challenge that requires you to log a lab cache.
Re: Labcaches August 13, 2020 09:48AM |
Registered: 5 years ago Posts: 4,125 |
Well, coordinates could give you country/region/county data, so they could be included in those type of challenges, in the same way that they may count for calendar finds, even though you may not explicitly request them. My above question was more aimed at for-my-info than a real request for challenges.
Re: Labcaches August 13, 2020 09:52AM |
Registered: 7 years ago Posts: 39 |
Re: Labcaches August 13, 2020 10:01AM |
Registered: 5 years ago Posts: 4,125 |
Re: Labcaches August 13, 2020 10:04AM |
Admin Registered: 7 years ago Posts: 772 |
Re: Labcaches August 13, 2020 11:10AM |
Registered: 7 years ago Posts: 39 |
Re: Labcaches August 13, 2020 12:53PM |
Admin Registered: 7 years ago Posts: 772 |
Re: Labcaches August 13, 2020 09:52AM |
Admin Registered: 7 years ago Posts: 772 |
Coordinates doesn't automatically get you the country, that's fairly complex and I am not sure that's a good route to walk either. However, it's likely that Project-GC will try to handle that at some point. But as long as they don't have a country field in HQs DB I don't think it's a good idea to use it. Mostly because it's not HQs intent.
Yes, they may be included when calculating calendars - and Project-GC already has support for that.
Yes, they may be included when calculating calendars - and Project-GC already has support for that.
Re: Labcaches August 13, 2020 11:56AM |
Registered: 7 years ago Posts: 18,618 |
Re: Labcaches August 13, 2020 11:05PM |
Registered: 7 years ago Posts: 1,814 |
Just a note on that - the API seems to provide the correct date, Geocaching.com seems (or at least seemed the last time I checked) to reassign the lab cache finds to the Seattle date at the time. PGC is reporting my lab cache finds on the correct dates (or at least is reporting the leap day finds on the correct date).
Re: Labcaches May 12, 2021 12:33PM |
Registered: 6 years ago Posts: 32 |
Hope this is the right place to ask,
since lab caches icons are now displayed in the geocaching app, are there any attemps to include Lab finds into those 360° Challenges like this one?
https://project-gc.com/Challenges/GC58QY2
since lab caches icons are now displayed in the geocaching app, are there any attemps to include Lab finds into those 360° Challenges like this one?
https://project-gc.com/Challenges/GC58QY2
Re: Labcaches May 12, 2021 12:36PM |
Admin Registered: 7 years ago Posts: 772 |
Team On Wrote:
-------------------------------------------------------
> Hope this is the right place to ask,
> since lab caches icons are now displayed in the
> geocaching app, are there any attemps to include
> Lab finds into those 360° Challenges like this
> one?
>
> https://project-gc.com/Challenges/GC58QY2
The 360-challenges are considered grandfathered and it's not likely there will be any code changes at all. Not the least since no new such challenges are allowed to be published.
Labcaches still aren't geocaches technically and Project-GC does not have the information needed to make the change you request. In fact, the data you need aren't shown on the maps either. The icon you see is some location chosen by the ALC owner, it's not the coordinates for each step, which should be the ones considered being "geocaches".
-------------------------------------------------------
> Hope this is the right place to ask,
> since lab caches icons are now displayed in the
> geocaching app, are there any attemps to include
> Lab finds into those 360° Challenges like this
> one?
>
> https://project-gc.com/Challenges/GC58QY2
The 360-challenges are considered grandfathered and it's not likely there will be any code changes at all. Not the least since no new such challenges are allowed to be published.
Labcaches still aren't geocaches technically and Project-GC does not have the information needed to make the change you request. In fact, the data you need aren't shown on the maps either. The icon you see is some location chosen by the ALC owner, it's not the coordinates for each step, which should be the ones considered being "geocaches".
Sorry, you do not have permission to post/reply in this forum.