davorg-cpan / genealogy-relationship

Calculate the relationship between two people
1 stars 1 forks source link

Use the field name attributes #6

Open davorg opened 1 year ago

davorg commented 1 year ago

We have three attributes that define the fields that are used to define how the "Person" class maps onto Genealogy::Relationship's code. But, currently, we never use them. We should fix that.

The attributes in question are:

So, for example, we have code in most_recent_ancestor() like this:

return $person1 if $person1->id == $person2->id;

Which should become something like this:

my $id_method = $self->identifier_field_name;
return $person1 if $person1->$id_method == $person2->$id_method;

Maybe there's a better way to approach this.

davorg commented 1 year ago

These attributes are also completely undocumented and untested. That should be fixed (and examples added to the SYNOPSIS).