From: INOPIAE Date: Mon, 30 Sep 2019 04:33:07 +0000 (+0200) Subject: fix: error when adding Verifications Points via Test Manager X-Git-Url: https://code.wpia.club/?p=gigi.git;a=commitdiff_plain;h=1ad34ca9dcc312a191dca6d88e889c2c3787b206 fix: error when adding Verifications Points via Test Manager fixes issue #86 Change-Id: I4175313ae2f73717b2f857f2e593f0a593d3afcf --- diff --git a/util-testing/club/wpia/gigi/pages/Manager.java b/util-testing/club/wpia/gigi/pages/Manager.java index bd90d262..f68d307b 100644 --- a/util-testing/club/wpia/gigi/pages/Manager.java +++ b/util-testing/club/wpia/gigi/pages/Manager.java @@ -409,17 +409,43 @@ public class Manager extends Page { } int vp = 0; + int verifications = 0; + String info = ""; try { - vp = Integer.parseInt(verificationPoints); - } catch (NumberFormatException e) { - resp.getWriter().println("No valid Verification Points entered.
"); - vp = 0; - } + try { + vp = Integer.parseInt(verificationPoints); + } catch (NumberFormatException e) { + resp.getWriter().println("The value for Verification Points must be an integer.
"); + vp = 0; + } + + int agentNumber = addVerificationPoints(vp, byEmail); + + while (vp > 0) { + int currentVP = 10; + if (vp < 10) { + currentVP = vp; + } + if (Notary.checkVerificationIsPossible(getAgent(agentNumber), byEmail.getPreferredName())) { + + Notary.verify(getAgent(agentNumber), byEmail, byEmail.getPreferredName(), byEmail.getDoB(), currentVP, "Testmanager Verify up code", validVerificationDateString(), VerificationType.FACE_TO_FACE, getRandomCountry()); + vp -= currentVP; + verifications += 1; - int agentNumber = addVerificationPoints(vp, byEmail); + } + agentNumber += 1; + if (agentNumber >= agents.length) { + info = "
The limit of agents is reached. You cannot add any more Verification Points to the preferred name of this user using this method."; + break; + } + } + + } catch (GigiApiException e) { + throw new Error(e); + } - resp.getWriter().println("User has been verified " + agentNumber + " times."); + resp.getWriter().println("User has been verified " + verifications + " times." + info); } else if (req.getParameter("letverify") != null) { String mail = req.getParameter("letverifyEmail");