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

Model Map for Person Alias has innacurate listings for 'AliasPerson' #5522

Closed
1 task done
smross opened this issue Jul 19, 2023 · 3 comments
Closed
1 task done

Model Map for Person Alias has innacurate listings for 'AliasPerson' #5522

smross opened this issue Jul 19, 2023 · 3 comments
Labels
Fixed in v15.2 Fixed in v16.0 Status: Confirmed It's clear what the subject of the issue is about, and what the resolution should be. Type: Bug Confirmed bugs or reports that are very likely to be bugs.

Comments

@smross
Copy link

smross commented Jul 19, 2023

Please go through all the tasks below

  • Check this box only after you have successfully completed both the above tasks

Please provide a brief description of the problem. Please do not forget to attach the relevant screenshots from your side.

The Model Map for Person Alias has the Property AliasPerson listed as a Database column. However, it's not a Database column. It's also not showing as something that can be queried using Lava in our Database(s).

Expected Behavior

The model map should correctly show if properties exist and if they are a database property (or other)

Actual Behavior

The property AliasPerson is listed as a Database Property in the Model Map
Monosnap Model Map  JIMROCK Rock RMS 2023-07-19 12-16-15(1)

Steps to Reproduce

  • Go to the 'Model Map'
  • Click on 'Person Alias'
  • AliasPerson is listed as a Property and is keyed as a database property
    Monosnap Model Map  JIMROCK Rock RMS 2023-07-19 12-16-15(1)

I checked the DB. Here's what Azure Data Studio lists for my DB's:
image

I was also unable to query any data from that property via Lava (here's the lava Jim Michael helped me use):

{% personalias where:'Id !="999999999"' %}
{% for personalias in personaliasItems %}
   {{ personalias.AliasPerson }}
{% endfor %}
{% endpersonalias %}

Rock Version

14.2, 15.1

Client Culture Setting

en-US

@nlBayside
Copy link
Contributor

nlBayside commented Jul 19, 2023

Below is the line that dictates whether the database icon or a gray square shows up in the Model Map.

property.NotMapped || property.IsVirtual ? "<i class='fa fa-square fa-fw o-20'></i> " : "<i class='fa fa-database fa-fw'></i> ", // 8

Settling for the [NotMapped] attribute would cause the column to not be mapped to the database, which is not the behavior we want at all.

So, the column exists but it isn't a Foreign Key in the SQL Database. The three connections shown here are CreatedBy/ModifiedByPersonAliasId and PersonId to the Person Table.
Screen Shot 2023-07-19 at 3 15 12 PM

My best guess is the PersonAlias class needs to be changed to not use internal get.
This is documented in Microsoft's documentation for the GetGetMethod()
Screen Shot 2023-07-19 at 3 25 01 PM

It's failing on the first boolean condition since GetGetMethod() is returning null. Since the property is already virtual then it would pass the second condition:

IsVirtual = p.GetGetMethod() != null && p.GetGetMethod().IsVirtual && !p.GetGetMethod().IsFinal,

@smross
Copy link
Author

smross commented Jul 20, 2023

@nlBayside, I'm not totally following you. I don't know C# and know enough SQL to do some things (but don't know most things).

The screenshot you displayed does not show a column for AliasPerson. It does show a column for AliasPersonId.

My point is that AliasPerson shows in the model map as a DB column, but doesn't exist in the DB (unless it's some wizardry I don't understand). I've used Rock's 'SQL Map' plugin, Azure Data Studio, and VS Code to examine the DB structure (expanding the 'Tables' tree and then the 'PersonAlias' subtree and then it's columns), and can't find AliasPerson.

@nlBayside
Copy link
Contributor

@smross, no worries! A lot of that info in my comment is just providing context in case someone from Spark sees the problem here.

You're correct that there isn't a column for AliasPerson in the database. The Model Map block pulls its information from C# class files rather than from the SQL schema. This allows the block to show more information than just what you'd find in the SQL tables. AliasPerson is configured in an odd way in the C# file and appears to only be meant for historical purposes when you merge people.

@nairdo nairdo added Type: Bug Confirmed bugs or reports that are very likely to be bugs. Status: Confirmed It's clear what the subject of the issue is about, and what the resolution should be. Fixed in v15.2 labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in v15.2 Fixed in v16.0 Status: Confirmed It's clear what the subject of the issue is about, and what the resolution should be. Type: Bug Confirmed bugs or reports that are very likely to be bugs.
Projects
None yet
Development

No branches or pull requests

3 participants