Created
March 31, 2015 16:18
-
-
Save rachelslurs/0ed5ba0c6e1e9f4fa635 to your computer and use it in GitHub Desktop.
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
def defineSenatorTrack() = | |
{ | |
// for every committee | |
committeeIssueSenatorMap.foreach( committee => { | |
committee._2.foreach(issueConf => { | |
issueConf._2.foreach( senator => { | |
val max = committee._2.foldLeft(0)( (result, current) => result + current._2.filter(_.faction.name.equalsIgnoreCase(senator.faction.name)).size) / 2 | |
// does the senator fit in subcommittee 1 | |
if(doesSenatorFitInSubCommittee(senator.faction.name, max, senator, committee._1.name,SUBCOMMITTEE_1_KEY)) { | |
// add | |
senatorTrackMap += ((senator,Map[String,String](COMMITTEE_KEY->committee._1.name, SUBCOMMITTEE_KEY->SUBCOMMITTEE_1_KEY, ISSUE_CONFERENCE_KEY-> issueConf._1))) | |
} | |
// or subcommittee 2 | |
else if(doesSenatorFitInSubCommittee(senator.faction.name, max, senator, committee._1.name,SUBCOMMITTEE_2_KEY)) { | |
// add | |
senatorTrackMap += ((senator,Map[String,String](COMMITTEE_KEY->committee._1.name, SUBCOMMITTEE_KEY->SUBCOMMITTEE_2_KEY, ISSUE_CONFERENCE_KEY-> issueConf._1))) | |
} else { | |
Logger.info("Could not fit senator") | |
} | |
}) | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment