Created
October 15, 2011 02:31
-
-
Save tauren/1288917 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Integer filled = new Integer(value); | |
if (filled != null) { | |
switch (filled) { | |
case 4: // Unassigned games - Games with no assignments filled | |
// Pseudocode: select games where count(assignments with status = ACCEPTED) = 0 and count(positions) > 0 | |
search.addFilterNone("assignments", Filter.equal("statusCode",AssignmentStatus.ACCEPTED.getCode())); | |
search.addFilterGreaterThan("schedule.positions.size", 0); | |
break; | |
case 3: // Partially assigned games - Games with some assignments filled | |
// Pseudocode: select games where count(assignments with status = ACCEPTED) < count(positions) | |
search.addFilterCustom("(select count(*) from {assignments} where statusCode = ?1 and game = {id}) < {schedule.positions.size}", | |
AssignmentStatus.ACCEPTED.getCode()); | |
break; | |
case 2: // Fully assigned games - Games with all assignments filled | |
// Psuedocode: select games where count(assignments with status = ACCEPTED) = count(positions) | |
search.addFilterCustom("(select count(*) from {assignments} where statusCode = ?1 and game = {id}) = {schedule.positions.size}", | |
AssignmentStatus.ACCEPTED.getCode()); | |
break; | |
case 1: // All games | |
// No filter | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment