Closed kojoty closed 2 years ago
This is great news. I've been working on attribute definitions the previous years (dataset) a lot and also created an attribute set (graphics). I paused because of the code changes it required. I am happy to share my work.
Please include attribute theme configuration directive.
Also note that OC UK has requested at least one new attribute (I had extensive talks with them in 2019) and the removal of several. I'll look it up and post it.
My work also included opencaching.eu documentation and a partial redefining of the attribute IDs from the current mess to a consistent, cross node uniform set.
IIRC I developed some SQL queries to help make the transition for cache - attribute mappings.
Don't forget OC US has some particular attribs as well, since they dropped some cache types in favour of attributes.
I'll recheck my attribute sheets and update the wiki.
Checking https://wiki.opencaching.eu/index.php?title=Cache_attributes against my master table. I think I have to update it with several of the OCUS attribs (derived from cache type fallback).
OCUS: CHALLENGE [id=??] - not listed in attributes index
OCUS: BITCACHE [id=??] - not listed in attributes index
OCUS: GUESTBOOK [id=??] - not listed in attributes index It looks like I have to document these first. Please allow me to do it first.
OCUK: ASKOWNER [id=156] - what is this? why do we need this? to be removed ( OCDE inspired legacy maybe (?) )
OCUK: OTHER [id=157] - what is this? why do we need this? to be removed
OCUK: AIRCRAFT [id=153] - really? how many such caches are there? to be removed from OCUK
Also, OCUK would like to add at least new attrib 217.
Before applying SQL updates on data (per note designed SQL queries) I think it best that I recheck them. (also in light with OCUS changes) See email in that regard.
Reading the code looks like I should make additional updates to the wiki (and my tables). Just to bring things in sync. Thank you very much for tackling this very large component.
Issues reference: https://github.com/opencaching/opencaching-pl/issues/462 https://github.com/opencaching/opencaching-pl/issues/806 https://github.com/opencaching/opencaching-pl/issues/1251 https://github.com/opencaching/opencaching-pl/issues/2013 https://github.com/opencaching/opencaching-pl/issues/2076 https://github.com/opencaching/opencaching-pl/issues/2277 at least.
From Facebook UK technical group:
I've had a look and it seems there are just 3 questions for us ... OCUK: ASKOWNER [id=156] - what is this? why do we need this? I have no idea ! OCUK: OTHER [id=157] - what is this? why do we need this? I have no idea on this one either OCUK: AIRCRAFT [id=153] - really? how many such caches are there? It seems unlikely there are any in the UK I have no problem with dropping all of these.
@kojoty could you check if any OC UK caches has these attributes?
OK I deliver the current version of the code and we will work on this. For now this is harmless as this code is not used anywhere.
BTW. Please see https://opencaching.pl/test/attributes for debug current config debug purpose :)
From Facebook UK technical group:
I've had a look and it seems there are just 3 questions for us ... OCUK: ASKOWNER [id=156] - what is this? why do we need this? I have no idea ! OCUK: OTHER [id=157] - what is this? why do we need this? I have no idea on this one either OCUK: AIRCRAFT [id=153] - really? how many such caches are there? It seems unlikely there are any in the UK I have no problem with dropping all of these.
@kojoty could you check if any OC UK caches has these attributes?
There is no Aircraft nor AskOwner, 2 caches with attrib. OTHER.
no php8 to w ogole wiele nowych uproszczeń w składni - no ale jeszcze chwilę poczekajmy...
On Tue, Oct 19, 2021 at 11:15 AM Grzegorz Deja - deg < @.***> wrote:
@.**** commented on this pull request.
In src/Models/GeoCache/CacheAttribute.php https://github.com/opencaching/opencaching-pl/pull/2304#discussion_r731658861 :
- Each node support only subset of attributes presents below.
*
- More details about OC attributes: https://wiki.opencaching.eu/index.php?title=Cache_attributes
*
- This class doesn't have connection to DB.
*/
+class CacheAttribute
+{
+
// attribute name = attribute ID
/* Access or parking fee /
const FEE = 2;
/* Climbing gear requried /
const RAPPELING = 3;
/* Boat required /
const BOAT = 4;
Alternatywnie można byłoby wczytywać te stałe w postaci tablic i przerabiać je pętlą for na obiekty, ale to chyba byłby przerost formy nad treścią.
Twój kod $supportedAttribsIds = [CacheAtt::FEE['id']] można też ewentualnie ugryźć czymś w rodzaju gettera i odwoływać się w stylu: $attribId = CacheAttribute::getId(CacheAttribute::FEE) ale to chyba też przerost formy. Taka forma pseudogettera ma tą zaletę, że ukrywa logikę przed pozostałym kodem (hermetyzacja) i docelowo czymkolwiek będzie CacheAttribute:FEE - zawsze będzie działało poprawnie i ewentualny refactoring kodu będzie dotyczył tylko jednego miejsca.
Jako ciekawostkę dorzucę, że w PHP8 kod typu:
class Attrib {
public int $id; public string $trKey; __construct Attrib($id, $trKey)
{
$this->id = $id; $this->trKey = $trKey; }
}
można skrócić do:
class Attrib {
__construct Attrib(public int $id, public string $trKey)
{}
}
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/opencaching/opencaching-pl/pull/2304#discussion_r731658861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWTAKB4QFSIFGPSJ7EN7G3UHUZJNANCNFSM5GFCBDWA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
There is no Aircraft nor AskOwner, 2 caches with attrib. OTHER. just remove the association between that attrib and the respective caches. Attribute is nonesense. (was some legacy from OCDE inspiration)
HI,
This is general refactoring of attributes for geocaches. I would like to clean it up, unify, move definition of attributes (config) from DB to files etc.
This is ONLY preparation - after merging this everything works the same - this code is not used at all.
How it works:
https://<node>/test/attributes
like: https://opencaching.pl/test/attributesStill to do:
we need to resolve a few details related to attributes not listed at: https://wiki.opencaching.eu/index.php?title=Cache_attributes or these I don't understand:
we should also update OKAPI code to not use DB for attributes dictionary - I will review the OKAPI needs later
I'm going to merge it soon, as this not affects the working code. If we decide it's OK I will deliver the changes to use the new approach in views with attributes. Next after delivering OKAPI changes we will be able to finally remove cache_attrib table from DB :)