Created
September 5, 2018 17:03
-
-
Save xfyre/544672451612c5ec49ec790325954fc2 to your computer and use it in GitHub Desktop.
WSDC All Star qualification criteria explained
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val isAllStarQualified = { | |
// 45 Advanced points accumulated within last 36 months | |
// OR | |
// has 3 All Star points within last 36 months | |
// OR | |
// has any All Star points AND 10 Advanced points within last 12 months | |
if (thisDivision == WsdcDivision.ALL_STAR) { | |
val maybeAdvPointsInPast3Years = maybePrevDivisionInfo.map { | |
advDivInfo => divisionInfoPlacements2(advDivInfo) | |
.filter(_.points > 0) | |
.filter(compWithinPastMonths(36)) | |
.foldLeft(0)(_ + _.points) | |
} | |
val maybeAllStarPointsInPast3Years = maybeThisDivisionInfo.map { | |
advDivInfo => divisionInfoPlacements2(advDivInfo) | |
.filter(_.points > 0) | |
.filter(compWithinPastMonths(36)) | |
.foldLeft(0)(_ + _.points) | |
} | |
val maybeAdvPointsInPast12Months = maybePrevDivisionInfo.map { | |
advDivInfo => divisionInfoPlacements2(advDivInfo) | |
.filter(_.points > 0) | |
.filter(compWithinPastMonths(12)) | |
.foldLeft(0)(_ + _.points) | |
} | |
val maybeAnyAllStarPoints = maybeThisDivisionInfo.map { | |
advDivInfo => divisionInfoPlacements2(advDivInfo) | |
.filter(_.points > 0) | |
.foldLeft(0)(_ + _.points) | |
} | |
maybeAdvPointsInPast3Years.exists(_ >= 45) || | |
maybeAllStarPointsInPast3Years.exists(_ >= 3) || | |
maybeAnyAllStarPoints.exists(_ > 0) && maybeAdvPointsInPast12Months.exists(_ >= 10) | |
} else { | |
false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment