/** * Loops through all currently loaded Students and matches Anon Codes If matched then replaces * anon codes with Student Name * * @param assessments - ArrayList of currently loaded Assessments * @param students - ArrayList of all students */ public void deAnnonymise(ArrayList<Assessment> assessments, ArrayList<Student> students) { for (Assessment a : assessments) { for (Result t : a.getResults()) { String candKey = t.getCandKey(); // Checks if candKey is actually student number // If candKey is student Number, then is coursework file if (candKey.substring(candKey.length() - 2, candKey.length() - 1).equals("/")) { // Removes the end /1 or /2 after student number candKey = candKey.substring(0, candKey.length() - 2); candKey = candKey.replaceAll("#", ""); for (Student s : students) { // Finds student with matching student numbers if (candKey.equals(s.getStudentNumber() + "")) { t.setCandKey(s.getStudentNumber() + ""); s.addMarks(t.getModuleCode() + " " + t.getAssessment(), t.getMark()); } } } else { // If candKey is anon code for (Student s : students) { candKey = candKey.replaceAll("#", ""); if (candKey.equals(s.getAMC() + "")) { // Finds student with matching anonymous marking code replaces it with student number t.setCandKey(s.getStudentNumber() + ""); t.setName(s.getName()); s.addMarks(t.getModuleCode() + " " + t.getAssessment(), t.getMark()); } } } } } }