SparkDevNetwork / Rock

An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
http://www.rockrms.com
580 stars 353 forks source link

LocationTypeValueId not populated or incorrect when expanding from Group #5988

Closed jimmyhogoboom closed 2 months ago

jimmyhogoboom commented 3 months ago

Description

Hello! I'm seeing some strange behavior which might be a bug. I hope I'm reporting this correctly and with enough information. Please let me know if I can provide any further details!

I noticed that LocationTypeValueId is missing or incorrect when queried via the /Groups endpoint. When querying via /GroupLocations directly, the GroupLocationTypeValueId is the expected value, and the correct value is also shown in the Rock UI.

Actual Behavior

Querying the /Groups endpoint using $expand of "GroupLocations/Location" and $select of "GroupLocations/Location" returns all address information, except the LocationTypeValueId is always null. Strangely enough, in my development installation, this value is actually always 19 ("Home" address) even when the address shows in Rock as "Previous".

When querying via /Groups

Screenshot 2024-08-20 at 4 02 41 PM

When querying via /GroupsLocations

Screenshot 2024-08-20 at 4 02 56 PM

Expected Behavior

Expected the LocationTypeValueId to match the address type shown in Rock or when querying via the /GroupLocations endpoint.

Steps to Reproduce

Issue Confirmation

Rock Version

Rock McKinley 16.6 (1.16.6.9)

Client Culture Setting

en-US

chead4 commented 2 months ago

@jimmyhogoboom Thanks for reaching out. I believe the value you’re looking for is the GroupLocationTypeValueId, which is included in the API results.

The UI currently is displaying the GroupLocationTypeValueId which is associated with the family’s GroupLocation. This ID is always populated when a Group is involved (e.g., Family, Small Group, etc.) with a Location (a GroupLocation).

On the other hand, only Named Locations such as Campuses, Buildings, and Rooms will have a value in the Locations LocationTypeValueId field.

jimmyhogoboom commented 2 months ago

Thank you for taking the time to look at this @chead4, I really appreciate it!

I apologize for my misunderstanding but especially for my hubris. I could have used the time I spent on this issue more deeply exploring the possibility of an error in my own code 😅