Make sure the last submitted is not the same!

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
sigonasr2 2022-08-20 14:37:49 -05:00
parent 80ab3f42fc
commit b4d270698a
3 changed files with 3 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -105,6 +105,7 @@ public class sigPlace {
try { try {
Robot r = new Robot(); Robot r = new Robot();
Reader lastReader = null; Reader lastReader = null;
Reader lastSubmittedReader = null;
int matches=0; int matches=0;
final int EXPECTED_MATCHES=7; final int EXPECTED_MATCHES=7;
boolean submitted=false; boolean submitted=false;
@ -135,7 +136,7 @@ public class sigPlace {
matches=0; matches=0;
submitted=false; submitted=false;
} }
if (matches>=EXPECTED_MATCHES&&!submitted) { if (matches>=EXPECTED_MATCHES&&!submitted&&!lastSubmittedReader.equals(result)) {
System.out.println("Data is reasonable, prepare for submitting..."); System.out.println("Data is reasonable, prepare for submitting...");
try { try {
POSTRequest postRes = new POSTRequest("http://"+args[1]+"/uploadform.html",temp); POSTRequest postRes = new POSTRequest("http://"+args[1]+"/uploadform.html",temp);
@ -144,6 +145,7 @@ public class sigPlace {
playSound(Paths.get("ding.wav")); playSound(Paths.get("ding.wav"));
System.out.println("Successful!"); System.out.println("Successful!");
submitted=true; submitted=true;
lastSubmittedReader=result;
} }
} catch (FailedResponseException e) { } catch (FailedResponseException e) {
System.out.println("Failed! "+e.getMessage()); System.out.println("Failed! "+e.getMessage());