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);
|
PublicationMetadata getByProject(Project project);
|
||||||
|
|
||||||
void save(PublicationMetadata publicationMetadata);
|
void save(PublicationMetadata publicationMetadata);
|
||||||
|
|
||||||
|
boolean hasSuppliedPublicationMetadata(Project project, boolean noNationalSubjectCategoriesAvailable);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package se.su.dsv.scipro.grading;
|
package se.su.dsv.scipro.grading;
|
||||||
|
|
||||||
import se.su.dsv.scipro.project.Project;
|
import se.su.dsv.scipro.project.Project;
|
||||||
|
import se.su.dsv.scipro.system.Language;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -29,4 +30,17 @@ class PublicationMetadataServiceImpl implements PublicationMetadataService {
|
|||||||
public void save(PublicationMetadata publicationMetadata) {
|
public void save(PublicationMetadata publicationMetadata) {
|
||||||
publicationMetadataRepository.save(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.Objects;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public class IndividualAuthorAssessment extends GenericPanel<User> {
|
public class IndividualAuthorAssessmentPanel extends GenericPanel<User> {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private NationalSubjectCategoryService nationalSubjectCategoryService;
|
||||||
@Inject
|
@Inject
|
||||||
private GradingReportService gradingReportService;
|
private GradingReportService gradingReportService;
|
||||||
@Inject
|
@Inject
|
||||||
@ -48,7 +50,7 @@ public class IndividualAuthorAssessment extends GenericPanel<User> {
|
|||||||
|
|
||||||
private final IModel<Project> projectModel;
|
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);
|
super(id, authorModel);
|
||||||
this.projectModel = projectModel;
|
this.projectModel = projectModel;
|
||||||
|
|
||||||
@ -75,7 +77,7 @@ public class IndividualAuthorAssessment extends GenericPanel<User> {
|
|||||||
redGreen("status_plagiarism", hasSubmittedPlagiarismAnalysis,
|
redGreen("status_plagiarism", hasSubmittedPlagiarismAnalysis,
|
||||||
"must_perform_plagiarism_check",
|
"must_perform_plagiarism_check",
|
||||||
"plagiarism_check_performed");
|
"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,
|
redGreen("status_publication_metadata", hasSuppliedPublicationMetadata,
|
||||||
"must_supply_publication_metadata",
|
"must_supply_publication_metadata",
|
||||||
"publication_metadata_supplied");
|
"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) {
|
private boolean gradingBasisDone(SupervisorGradingReport supervisorGradingReport) {
|
||||||
boolean criteriaMet = supervisorGradingReport.getProjectCriteria()
|
boolean criteriaMet = supervisorGradingReport.getProjectCriteria()
|
||||||
.stream()
|
.stream()
|
@ -3,12 +3,12 @@
|
|||||||
<body>
|
<body>
|
||||||
<wicket:panel>
|
<wicket:panel>
|
||||||
<div class="mb-3">
|
<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>
|
<textarea class="form-control" id="abstract_en" wicket:id="abstract_en"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<wicket:enclosure>
|
<wicket:enclosure>
|
||||||
<div class="mb-3">
|
<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>
|
<textarea class="form-control" id="abstract_sv" wicket:id="abstract_sv"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</wicket:enclosure>
|
</wicket:enclosure>
|
||||||
@ -22,11 +22,13 @@
|
|||||||
<input class="form-control" id="keywords_sv" wicket:id="keywords_sv">
|
<input class="form-control" id="keywords_sv" wicket:id="keywords_sv">
|
||||||
</div>
|
</div>
|
||||||
</wicket:enclosure>
|
</wicket:enclosure>
|
||||||
<div class="mb-3">
|
<wicket:enclosure>
|
||||||
<label class="form-label" for="national_subject_category">National subject category</label>
|
<div class="mb-3">
|
||||||
<select class="form-select" id="national_subject_category" wicket:id="national_subject_category">
|
<label class="form-label" for="national_subject_category">National subject category (required)</label>
|
||||||
</select>
|
<select class="form-select" id="national_subject_category" wicket:id="national_subject_category">
|
||||||
</div>
|
</select>
|
||||||
|
</div>
|
||||||
|
</wicket:enclosure>
|
||||||
</wicket:panel>
|
</wicket:panel>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -45,6 +45,7 @@ public class PublicationMetadataFormComponentPanel extends GenericPanel<Publicat
|
|||||||
.ifPresent(nationalSubjectCategoryChoice::setDefaultModelObject);
|
.ifPresent(nationalSubjectCategoryChoice::setDefaultModelObject);
|
||||||
}
|
}
|
||||||
nationalSubjectCategoryChoice.setNullValid(true);
|
nationalSubjectCategoryChoice.setNullValid(true);
|
||||||
|
nationalSubjectCategoryChoice.setVisible(!availableCategories.getObject().isEmpty());
|
||||||
add(nationalSubjectCategoryChoice);
|
add(nationalSubjectCategoryChoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,8 @@ import java.util.Set;
|
|||||||
|
|
||||||
@ProjectModuleComponent(ProjectModule.GRADING)
|
@ProjectModuleComponent(ProjectModule.GRADING)
|
||||||
public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetailsPage {
|
public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetailsPage {
|
||||||
|
@Inject
|
||||||
|
private NationalSubjectCategoryService nationalSubjectCategoryService;
|
||||||
@Inject
|
@Inject
|
||||||
private GeneralSystemSettingsService generalSystemSettingsService;
|
private GeneralSystemSettingsService generalSystemSettingsService;
|
||||||
@Inject
|
@Inject
|
||||||
@ -76,12 +78,7 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
|||||||
.isPresent();
|
.isPresent();
|
||||||
add(newGreenHighlight("step_plagiarism", hasCheckedForPlagiarism, new ResourceModel("step_plagiarism")));
|
add(newGreenHighlight("step_plagiarism", hasCheckedForPlagiarism, new ResourceModel("step_plagiarism")));
|
||||||
|
|
||||||
IModel<Boolean> hasProvidedPublicationMetadata =
|
IModel<Boolean> hasProvidedPublicationMetadata = Model.of(publicationMetadataService.hasSuppliedPublicationMetadata(projectModel.getObject(), nationalSubjectCategoryService.listCategories().isEmpty()));
|
||||||
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();
|
|
||||||
add(newGreenHighlight("step_publication_metadata", hasProvidedPublicationMetadata, new ResourceModel("step_publication_metadata")));
|
add(newGreenHighlight("step_publication_metadata", hasProvidedPublicationMetadata, new ResourceModel("step_publication_metadata")));
|
||||||
|
|
||||||
IModel<List<SupervisorGradingReport>> gradingReports = LoadableDetachableModel.of(() ->
|
IModel<List<SupervisorGradingReport>> gradingReports = LoadableDetachableModel.of(() ->
|
||||||
@ -132,7 +129,7 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
|||||||
.map(author -> new DetachableServiceModel<>(userService, author))
|
.map(author -> new DetachableServiceModel<>(userService, author))
|
||||||
.map(authorModel -> createTab(
|
.map(authorModel -> createTab(
|
||||||
authorModel.map(User::getFullName),
|
authorModel.map(User::getFullName),
|
||||||
panelId -> new IndividualAuthorAssessment(panelId, projectModel, authorModel)))
|
panelId -> new IndividualAuthorAssessmentPanel(panelId, projectModel, authorModel)))
|
||||||
.toList();
|
.toList();
|
||||||
tabs.addAll(authorTabs);
|
tabs.addAll(authorTabs);
|
||||||
|
|
||||||
@ -152,10 +149,6 @@ public class SupervisorGradingReportPage extends AbstractSupervisorProjectDetail
|
|||||||
add(new ExaminerTimelinePanel("examiner_timeline", projectModel));
|
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) {
|
private Component newGreenHighlight(String id, IModel<Boolean> completed, IModel<String> text) {
|
||||||
return new RedGreenLabel(id, completed, text, text);
|
return new RedGreenLabel(id, completed, text, text);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user