forked from pc2ccs/pc2v9
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i_999 CI bug fixes to SubmitSampleRunsPane
CI: While testing the new sandbox time grace periods, a couple of bugs were found in the SubmitSampleRunsPane (which is used to submit the judge's sample solutions by an administrator. The following were fixed/added to support SubmitSampleRuns. 1) Add alphanumeric sorting instead of pure numeric sorting for some columns since some columns may have both text and numbers in them. 2) Synchronize the add runs since we appear to get 2 runAdded notifications for each run from different worker threads. 3) Fixed bug in Filter where if a custom filter group is used alone, it would not allow you to enable filtering.
- Loading branch information
Showing
6 changed files
with
162 additions
and
69 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/edu/csus/ecs/pc2/core/list/AlphaNumericComparator.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (C) 1989-2024 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau. | ||
package edu.csus.ecs.pc2.core.list; | ||
|
||
import java.io.Serializable; | ||
import java.util.Comparator; | ||
|
||
/** | ||
* Compare the two strings as numbers | ||
* <P> | ||
* Compare things that may be words or numbers | ||
* | ||
* @author John Buck | ||
*/ | ||
|
||
// $HeadURL$ | ||
// $Id$ | ||
|
||
public class AlphaNumericComparator implements Comparator<String>, Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public int compare(String ValOne, String ValTwo) { | ||
boolean b1Alpha = false; | ||
boolean b2Alpha = false; | ||
int cmpVal1 = 0; | ||
int cmpVal2 = 0; | ||
|
||
try { | ||
cmpVal1 = Integer.parseInt(ValOne); | ||
} catch(Exception exception) { | ||
b1Alpha = true; | ||
} | ||
try { | ||
cmpVal2 = Integer.parseInt(ValTwo); | ||
} catch(Exception exception) { | ||
b2Alpha = true; | ||
} | ||
if(b1Alpha) { | ||
// If both are alpha, then just compare the strings. | ||
if(b2Alpha) { | ||
return(ValOne.compareToIgnoreCase(ValTwo)); | ||
} | ||
// ValTwo is a number, and it comes before the alpha | ||
return(1); | ||
} | ||
if(b2Alpha) { | ||
// ValOne is a number, it comes before the alpha string | ||
return(-1); | ||
} | ||
return(cmpVal1 - cmpVal2); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
src/edu/csus/ecs/pc2/core/list/LabelToDoubleComparator.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright (C) 1989-2024 PC2 Development Team: John Clevenger, Douglas Lane, Samir Ashoo, and Troy Boudreau. | ||
package edu.csus.ecs.pc2.core.list; | ||
|
||
import java.io.Serializable; | ||
import java.util.Comparator; | ||
|
||
import javax.swing.JLabel; | ||
|
||
/** | ||
* Compare the two strings as numbers | ||
* <P> | ||
* Simply convert to integers and compare | ||
* | ||
* @version $Id$ | ||
* @author John Buck | ||
*/ | ||
|
||
// $HeadURL$ | ||
// $Id$ | ||
|
||
public class LabelToDoubleComparator implements Comparator<JLabel>, Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@Override | ||
public int compare(JLabel LabOne, JLabel LabTwo) { | ||
String valOne = LabOne.getText(); | ||
String valTwo = LabTwo.getText(); | ||
boolean b1Alpha = false; | ||
boolean b2Alpha = false; | ||
double cmpVal1 = 0; | ||
double cmpVal2 = 0; | ||
|
||
try { | ||
cmpVal1 = Double.parseDouble(valOne); | ||
} catch(Exception exception) { | ||
b1Alpha = true; | ||
} | ||
try { | ||
cmpVal2 = Double.parseDouble(valTwo); | ||
} catch(Exception exception) { | ||
b2Alpha = true; | ||
} | ||
if(b1Alpha) { | ||
// If both are alpha, then just compare the strings. | ||
if(b2Alpha) { | ||
return(valOne.compareToIgnoreCase(valTwo)); | ||
} | ||
// ValTwo is a number, and it comes before the alpha | ||
return(1); | ||
} | ||
if(b2Alpha) { | ||
// ValOne is a number, it comes before the alpha string | ||
return(-1); | ||
} | ||
double dResult = cmpVal1 - cmpVal2; | ||
if(dResult < 0) { | ||
return(-1); | ||
} else if(dResult > 0) { | ||
return(1); | ||
} | ||
return(0); | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
src/edu/csus/ecs/pc2/core/list/StringToDoubleComparator.java
This file was deleted.
Oops, something went wrong.
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
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
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