private Map<String, Integer> getFinishedDocumentsPerUser(Project aProject) { Map<String, Integer> annotatorsProgress = new HashMap<>(); if (aProject != null) { for (User user : projectService.listProjectUsersWithPermissions(aProject, PermissionLevel.ANNOTATOR)) { for (SourceDocument document : documentService.listSourceDocuments(aProject)) { if (documentService.isAnnotationFinished(document, user)) { if (annotatorsProgress.get(user.getUsername()) == null) { annotatorsProgress.put(user.getUsername(), 1); } else { int previousValue = annotatorsProgress.get(user.getUsername()); annotatorsProgress.put(user.getUsername(), previousValue + 1); } } } if (annotatorsProgress.get(user.getUsername()) == null) { annotatorsProgress.put(user.getUsername(), 0); } } } return annotatorsProgress; }
private Map<String, Integer> getPercentageOfFinishedDocumentsPerUser(Project aProject) { Map<String, Integer> annotatorsProgress = new HashMap<>(); if (aProject != null) { for (User user : projectService.listProjectUsersWithPermissions(aProject, PermissionLevel.ANNOTATOR)) { int finished = 0; int ignored = 0; int totalDocs = 0; List<SourceDocument> documents = documentService.listSourceDocuments(aProject); for (SourceDocument document : documents) { totalDocs++; if (documentService.isAnnotationFinished(document, user)) { finished++; } else if (documentService.existsAnnotationDocument(document, user)) { AnnotationDocument annotationDocument = documentService .getAnnotationDocument(document, user); if (annotationDocument.getState().equals(AnnotationDocumentState.IGNORE)) { ignored++; } } } annotatorsProgress.put(user.getUsername(), (int) Math.round((double) (finished * 100) / (totalDocs - ignored))); } } return annotatorsProgress; }
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = AutomationPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = AnnotationPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = AutomationPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = CorrectionPage.this.getModelObject(); setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); } });
boolean isAnnotationFinished() { AnnotatorState state = getModelObject(); if (state.getMode().equals(Mode.CURATION)) { return state.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED); } else { return documentService.isAnnotationFinished(state.getDocument(), state.getUser()); } }
protected ActionBarLink createOrGetResetDocumentLink() { if (resetDocumentLink == null) { resetDocumentLink = new ActionBarLink("showResetDocumentDialog", t -> resetDocumentDialog.show(t)); resetDocumentLink.onConfigure(_this -> { AnnotatorState state = AnnotationPageBase.this.getModelObject(); _this.setEnabled(state.getDocument() != null && !documentService .isAnnotationFinished(state.getDocument(), state.getUser())); }); } return resetDocumentLink; }