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

Clever sort #69

Open
davorg opened this issue Dec 16, 2019 · 0 comments
Open

Clever sort #69

davorg opened this issue Dec 16, 2019 · 0 comments
Assignees

Comments

@davorg
Copy link
Owner

davorg commented Dec 16, 2019

Add a sort method that handles the Succession to the Crown Act.

Pseudocode:

if ($a->gender ne $b->gender) {
  if ($a->gender eq 'm') {
    if ($a->born < '28 October 2011') {
      return -1;
    } else {
      return $a->born <=> $b->born;
    }
  } else {
    if ($b->born < '28 October 2011') {
      return 1;
    } else {
      return $a->born <=> $b->born;
    }
  }
} else {
   return $a->born <=> $b->born;
}

Should probably be a method on the person resultset.

@davorg davorg self-assigned this Dec 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant