Advanced

Labcaches

Labcaches
January 15, 2020 12:12PM
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
	/// @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 12:13PM by magma1447. (view changes)
Re: Labcaches
January 15, 2020 06:18PM
I assume it's not deployed yet?

Caught exception: attempt to call field 'GetLabCacheFinds' (a nil value)
Re: Labcaches
January 15, 2020 06:27PM
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.
Re: Labcaches
January 15, 2020 07:13PM
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).
Re: Labcaches
January 15, 2020 07:15PM
GetLabCacheFinds() works for me now.
Sorry, you do not have permission to post/reply in this forum.