2870 Stöd för att ange nationellt ämneskategori i samband med att godkänner final thesis
This commit is contained in:
parent
a76ff3db2a
commit
3a530879a7
core/src/main/java/se/su/dsv/scipro/grading
view/src/main/java/se/su/dsv/scipro/grading
@ -6,4 +6,6 @@ public interface PublicationMetadataService {
|
||||
PublicationMetadata getByProject(Project project);
|
||||
|
||||
void save(PublicationMetadata publicationMetadata);
|
||||
|
||||
boolean hasSuppliedPublicationMetadata(Project project, boolean noNationalSubjectCategoriesAvailable);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package se.su.dsv.scipro.grading;
|
||||
|
||||
import se.su.dsv.scipro.project.Project;
|
||||
import se.su.dsv.scipro.system.Language;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Objects;
|
||||
@ -29,4 +30,17 @@ class PublicationMetadataServiceImpl implements PublicationMetadataService {
|
||||
public void save(PublicationMetadata publicationMetadata) {
|
||||
publicationMetadataRepository.save(publicationMetadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuppliedPublicationMetadata(Project project, boolean noNationalSubjectCategoriesAvailable) {
|
||||
final PublicationMetadata metadata = getByProject(project);
|
||||
return notBlank(metadata.getAbstractEnglish()) &&
|
||||
(project.getLanguage() == Language.ENGLISH || notBlank(metadata.getAbstractSwedish())) &&
|
||||
(noNationalSubjectCategoriesAvailable || metadata.getNationalSubjectCategory() != null);
|
||||
}
|
||||
|
||||
private boolean notBlank(String s) {
|
||||
return s != null && !s.isBlank();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,8 +33,10 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public class IndividualAuthorAssessment extends GenericPanel<User> {
|
||||
public class IndividualAuthorAssessmentPanel extends GenericPanel<User> {
|
||||
|
||||
@Inject
|
||||
private NationalSubjectCategoryService nationalSubjectCategoryService;
|
||||
@Inject
|
||||
private GradingReportService gradingReportService;
|
||||
@Inject
|
||||
@ -48,7 +50,7 @@ public class IndividualAuthorAssessment extends GenericPanel<User> {
|
||||
|
||||
private final IModel<Project> projectModel;
|
||||
|
||||
public IndividualAuthorAssessment(String id, IModel<Project> projectModel, IModel<User> authorModel) {
|
||||
public IndividualAuthorAssessmentPanel(String id, IModel<Project> projectModel, IModel<User> authorModel) {
|
||||
super(id, authorModel);
|
||||
this.projectModel = projectModel;
|
||||
|
||||
@ -75,7 +77,7 @@ public class IndividualAuthorAssessment extends GenericPanel<User> {
|
||||
redGreen("status_plagiarism", hasSubmittedPlagiarismAnalysis,
|
||||
"must_perform_plagiarism_check",
|
||||
"plagiarism_check_performed");
|
||||
IModel<Boolean> hasSuppliedPublicationMetadata = hasSuppliedPublicationMetadata(projectModel);
|
||||
IModel<Boolean> hasSuppliedPublicationMetadata = Model.of(publicationMetadataService.hasSuppliedPublicationMetadata(projectModel.getObject(), nationalSubjectCategoryService.listCategories().isEmpty()));
|
||||
redGreen("status_publication_metadata", hasSuppliedPublicationMetadata,
|
||||
"must_supply_publication_metadata",
|
||||
"publication_metadata_supplied");
|
||||
@ -182,18 +184,6 @@ public class IndividualAuthorAssessment extends GenericPanel<User> {
|
||||
});
|
||||
}
|
||||
|
||||
private IModel<Boolean> hasSuppliedPublicationMetadata(IModel<Project> projectModel) {
|
||||
return LoadableDetachableModel.of(() -> publicationMetadataService.getByProject(projectModel.getObject()))
|
||||
.filter(metadata -> notBlank(metadata.getAbstractEnglish()) || notBlank(metadata.getAbstractSwedish()))
|
||||
.filter(metadata -> notBlank(metadata.getKeywordsEnglish()) || notBlank(metadata.getKeywordsSwedish()))
|
||||
.filter(metadata -> metadata.getNationalSubjectCategory() != null)
|
||||
.isPresent();
|
||||
}
|
||||
|
||||
private boolean notBlank(String s) {
|
||||
return s != null && !s.isBlank();
|
||||
}
|
||||
|
||||
private boolean gradingBasisDone(SupervisorGradingReport supervisorGradingReport) {
|
||||
boolean criteriaMet = supervisorGradingReport.getProjectCriteria()
|
||||
.stream()
|
@ -3,12 +3,12 @@
|
||||
<body>
|
||||
<wicket:panel>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="abstract_en">Abstract (English)</label>
|
||||
<label class="form-label" for="abstract_en">Abstract (English) (required)</label>
|
||||
<textarea class="form-control" id="abstract_en" wicket:id="abstract_en"></textarea>
|
||||
</div>
|
||||
<wicket:enclosure>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="abstract_sv">Abstract (Swedish)</label>
|
||||
<label class="form-label" for="abstract_sv">Abstract (Swedish) (required)</label>
|
||||
<textarea class="form-control" id="abstract_sv" wicket:id="abstract_sv"></textarea>
|
||||
</div>
|
||||
</wicket:enclosure>
|
||||
@ -22,11 +22,13 @@
|
||||
<input class="form-control" id="keywords_sv" wicket:id="keywords_sv">
|
||||
</div>
|
||||
</wicket:enclosure>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="national_subject_category">National subject category</label>
|
||||
<select class="form-select" id="national_subject_category" wicket:id="national_subject_category">
|
||||
</select>
|
||||
</div>
|
||||
<wicket:enclosure>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="national_subject_category">National subject category (required)</label>
|
||||
<select class="form-select" id="national_subject_category" wicket:id="national_subject_category">
|
||||
</select>
|
||||
</div>
|
||||
</wicket:enclosure>
|
||||
</wicket:panel>
|
||||
</body>
|
||||
</html>
|
@ -45,6 +45,7 @@ public class PublicationMetadataFormComponentPanel extends GenericPanel<Publicat
|
||||
.ifPresent(nationalSubjectCategoryChoice::setDefaultModelObject);
|
||||
}
|
||||
nationalSubjectCategoryChoice.setNullValid(true);
|
||||
nationalSubjectCategoryChoice.setVisible(!availableCategories.getObject().isEmpty());
|
||||
add(nationalSubjectCategoryChoice);
|
||||
}
|
||||
|
||||
|
@ -46,6 +46,8 @@ import java.util.Set;
|
||||
|
||||
@ProjectModuleComponent(ProjectModule.GRADING)
|
||||
public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetailsPage {
|
||||
@Inject
|
||||
private NationalSubjectCategoryService nationalSubjectCategoryService;
|
||||
@Inject
|
||||
private GeneralSystemSettingsService generalSystemSettingsService;
|
||||
@Inject
|
||||
@ -76,12 +78,7 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
||||
.isPresent();
|
||||
add(newGreenHighlight("step_plagiarism", hasCheckedForPlagiarism, new ResourceModel("step_plagiarism")));
|
||||
|
||||
IModel<Boolean> hasProvidedPublicationMetadata =
|
||||
projectModel.map(publicationMetadataService::getByProject)
|
||||
.filter(metadata -> notBlank(metadata.getAbstractEnglish()) || notBlank(metadata.getAbstractSwedish()))
|
||||
.filter(metadata -> notBlank(metadata.getKeywordsEnglish()) || notBlank(metadata.getKeywordsSwedish()))
|
||||
.filter(metadata -> metadata.getNationalSubjectCategory() != null)
|
||||
.isPresent();
|
||||
IModel<Boolean> hasProvidedPublicationMetadata = Model.of(publicationMetadataService.hasSuppliedPublicationMetadata(projectModel.getObject(), nationalSubjectCategoryService.listCategories().isEmpty()));
|
||||
add(newGreenHighlight("step_publication_metadata", hasProvidedPublicationMetadata, new ResourceModel("step_publication_metadata")));
|
||||
|
||||
IModel<List<SupervisorGradingReport>> gradingReports = LoadableDetachableModel.of(() ->
|
||||
@ -132,7 +129,7 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
||||
.map(author -> new DetachableServiceModel<>(userService, author))
|
||||
.map(authorModel -> createTab(
|
||||
authorModel.map(User::getFullName),
|
||||
panelId -> new IndividualAuthorAssessment(panelId, projectModel, authorModel)))
|
||||
panelId -> new IndividualAuthorAssessmentPanel(panelId, projectModel, authorModel)))
|
||||
.toList();
|
||||
tabs.addAll(authorTabs);
|
||||
|
||||
@ -152,10 +149,6 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
||||
add(new ExaminerTimelinePanel("examiner_timeline", projectModel));
|
||||
}
|
||||
|
||||
private boolean notBlank(String s) {
|
||||
return s != null && !s.isBlank();
|
||||
}
|
||||
|
||||
private Component newGreenHighlight(String id, IModel<Boolean> completed, IModel<String> text) {
|
||||
return new RedGreenLabel(id, completed, text, text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user