task/3382: Harmonisera tabellnamn #6
@ -61,7 +61,7 @@ public class MilestoneActivator {
|
|||||||
int minimumActiveParticipationsToBeGraded = event.getProject()
|
int minimumActiveParticipationsToBeGraded = event.getProject()
|
||||||
.getProjectType()
|
.getProjectType()
|
||||||
.getProjectTypeSettings()
|
.getProjectTypeSettings()
|
||||||
.getMinimumActiveParticipationsToBeGraded();
|
.getMinActiveParticipationsToBeGraded();
|
||||||
if (completedParticipations >= minimumActiveParticipationsToBeGraded) {
|
if (completedParticipations >= minimumActiveParticipationsToBeGraded) {
|
||||||
activateIndividualMilestone(Set.of("ParticipationGradingEvent"), event.getProject(), event.getStudent());
|
activateIndividualMilestone(Set.of("ParticipationGradingEvent"), event.getProject(), event.getStudent());
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,68 +1,83 @@
|
|||||||
package se.su.dsv.scipro.system;
|
package se.su.dsv.scipro.system;
|
||||||
|
|
||||||
import jakarta.persistence.*;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import jakarta.persistence.Cacheable;
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.GeneratedValue;
|
||||||
|
import jakarta.persistence.GenerationType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="project_type_settings")
|
|
||||||
@Cacheable(true)
|
@Cacheable(true)
|
||||||
|
@Table(name="project_type_settings")
|
||||||
public class ProjectTypeSettings extends DomainObject {
|
public class ProjectTypeSettings extends DomainObject {
|
||||||
public ProjectTypeSettings(){}
|
public static final int DEFAULT_NUM_DAYS_BETWEEN_REVIEWS_ON_SAME_PROJECT = 7;
|
||||||
|
public static final int DEFAULT_NUM_DAYS_TO_SUBMIT_PEER_REVIEW = 3;
|
||||||
public ProjectTypeSettings(ProjectType projectType){
|
public static final int DEFAULT_NUM_DAYS_BEFORE_CANCELLED_PEERS = 90;
|
||||||
this.projectType = projectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@OneToOne(optional = false)
|
@OneToOne(optional = false)
|
||||||
|
@Column(name = "project_type_id")
|
||||||
private ProjectType projectType;
|
private ProjectType projectType;
|
||||||
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int minAuthors = 1;
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int maxAuthors = 2;
|
|
||||||
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int maxFinalSeminarActiveParticipation;
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int maxOpponentsOnFinalSeminar;
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int minFinalSeminarActiveParticipation;
|
|
||||||
@Basic(optional=false)
|
|
||||||
private int minOpponentsOnFinalSeminar;
|
|
||||||
|
|
||||||
private int minimumOppositionsToBeGraded = 0;
|
|
||||||
private int minimumActiveParticipationsToBeGraded = 0;
|
|
||||||
|
|
||||||
public static final int DEFAULT_NUM_DAYS_BETWEEN_REVIEWS_ON_SAME_PROJECT = 7;
|
|
||||||
public static final int DEFAULT_NUM_DAYS_TO_SUBMIT_PEER_REVIEW = 3;
|
|
||||||
public static final int DEFAULT_NUM_DAYS_BEFORE_CANCELLED_PEERS = 90;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the time span between reviews on the same project
|
* Defines the time span between reviews on the same project
|
||||||
*/
|
*/
|
||||||
@Basic(optional = false)
|
@Column(name = "num_days_between_peer_reviews_on_same_project", nullable = false)
|
||||||
private int numDaysBetweenPeerReviewsOnSameProject = DEFAULT_NUM_DAYS_BETWEEN_REVIEWS_ON_SAME_PROJECT;
|
private int numDaysBetweenPeerReviewsOnSameProject = DEFAULT_NUM_DAYS_BETWEEN_REVIEWS_ON_SAME_PROJECT;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the number of days between accepting a review and the deadline for review submission
|
* Defines the number of days between accepting a review and the deadline for review submission
|
||||||
*/
|
*/
|
||||||
@Basic(optional = false)
|
@Column(name = "num_days_to_submit_peer_review", nullable = false)
|
||||||
private int numDaysToSubmitPeerReview = DEFAULT_NUM_DAYS_TO_SUBMIT_PEER_REVIEW;
|
private int numDaysToSubmitPeerReview = DEFAULT_NUM_DAYS_TO_SUBMIT_PEER_REVIEW;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines the number of days between accepting a review and the deadline for review submission
|
* Defines the number of days between accepting a review and the deadline for review submission
|
||||||
*/
|
*/
|
||||||
@Basic(optional = false)
|
@Column(name = "num_days_before_peer_gets_cancelled", nullable = false)
|
||||||
private int numDaysBeforePeerGetsCancelled = DEFAULT_NUM_DAYS_BEFORE_CANCELLED_PEERS;
|
private int numDaysBeforePeerGetsCancelled = DEFAULT_NUM_DAYS_BEFORE_CANCELLED_PEERS;
|
||||||
|
|
||||||
@Basic
|
@Column(name = "min_authors", nullable = false)
|
||||||
|
private int minAuthors = 1;
|
||||||
|
|
||||||
|
@Column(name = "max_authors", nullable = false)
|
||||||
|
private int maxAuthors = 2;
|
||||||
|
|
||||||
|
@Column(name = "max_final_seminar_active_participation", nullable = false)
|
||||||
|
private int maxFinalSeminarActiveParticipation;
|
||||||
|
|
||||||
|
@Column(name = "max_opponents_on_final_seminar", nullable = false)
|
||||||
|
private int maxOpponentsOnFinalSeminar;
|
||||||
|
|
||||||
|
@Column(name = "min_final_seminar_active_participation", nullable = false)
|
||||||
|
private int minFinalSeminarActiveParticipation;
|
||||||
|
|
||||||
|
@Column(name = "min_opponents_on_final_seminar", nullable = false)
|
||||||
|
private int minOpponentsOnFinalSeminar;
|
||||||
|
|
||||||
|
@Column(name = "min_oppositions_to_be_graded")
|
||||||
|
private int minOppositionsToBeGraded = 0;
|
||||||
|
|
||||||
|
@Column(name = "min_active_participations_to_be_graded")
|
||||||
|
private int minActiveParticipationsToBeGraded = 0;
|
||||||
|
|
||||||
@Column(name = "review_process_information_url_for_supervisor")
|
@Column(name = "review_process_information_url_for_supervisor")
|
||||||
private String reviewProcessInformationUrl;
|
private String reviewProcessInformationUrl;
|
||||||
|
|
||||||
|
public ProjectTypeSettings(){}
|
||||||
|
|
||||||
|
public ProjectTypeSettings(ProjectType projectType){
|
||||||
|
this.projectType = projectType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
@ -152,20 +167,20 @@ public class ProjectTypeSettings extends DomainObject {
|
|||||||
this.numDaysBeforePeerGetsCancelled = numDaysBeforePeerGetsCancelled;
|
this.numDaysBeforePeerGetsCancelled = numDaysBeforePeerGetsCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumOppositionsToBeGraded() {
|
public int getMinOppositionsToBeGraded() {
|
||||||
return minimumOppositionsToBeGraded;
|
return minOppositionsToBeGraded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinimumOppositionsToBeGraded(int minimumOppositionsToBeGraded) {
|
public void setMinOppositionsToBeGraded(int minimumOppositionsToBeGraded) {
|
||||||
this.minimumOppositionsToBeGraded = minimumOppositionsToBeGraded;
|
this.minOppositionsToBeGraded = minimumOppositionsToBeGraded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinimumActiveParticipationsToBeGraded() {
|
public int getMinActiveParticipationsToBeGraded() {
|
||||||
return minimumActiveParticipationsToBeGraded;
|
return minActiveParticipationsToBeGraded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinimumActiveParticipationsToBeGraded(int minimumActiveParticipationsToBeGraded) {
|
public void setMinActiveParticipationsToBeGraded(int minimumActiveParticipationsToBeGraded) {
|
||||||
this.minimumActiveParticipationsToBeGraded = minimumActiveParticipationsToBeGraded;
|
this.minActiveParticipationsToBeGraded = minimumActiveParticipationsToBeGraded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getReviewProcessInformationUrl() {
|
public String getReviewProcessInformationUrl() {
|
||||||
|
@ -774,8 +774,36 @@ alter table `project_type_project_module`
|
|||||||
add constraint pk_project_type_project_module
|
add constraint pk_project_type_project_module
|
||||||
primary key(project_type_id, project_module);
|
primary key(project_type_id, project_module);
|
||||||
|
|
||||||
|
-- fix table project_type_settings except foreign key to table project_type
|
||||||
|
|
||||||
|
alter table `project_type_settings` drop foreign key `FK_oxqyb1t8jo7cq2fx8j9slvloa`;
|
||||||
|
alter table `project_type_settings` drop foreign key `FK_project_class_settings_projectType`;
|
||||||
|
alter table `project_type_settings` drop key `UK_project_class_settings_projectType`;
|
||||||
|
|
||||||
|
alter table `project_type_settings` rename column `numDaysBetweenPeerReviewsOnSameProject` to `num_days_between_peer_reviews_on_same_project`;
|
||||||
|
alter table `project_type_settings` rename column `numDaysToSubmitPeerReview` to `num_days_to_submit_peer_review`;
|
||||||
|
alter table `project_type_settings` rename column `projectType_id` to `project_type_id`;
|
||||||
|
alter table `project_type_settings` rename column `numDaysBeforePeerGetsCancelled` to `num_days_before_peer_gets_cancelled`;
|
||||||
|
alter table `project_type_settings` rename column `minAuthors` to `min_authors`;
|
||||||
|
alter table `project_type_settings` rename column `maxAuthors` to `max_authors`;
|
||||||
|
alter table `project_type_settings` rename column `maxFinalSeminarActiveParticipation` to `max_final_seminar_active_participation`;
|
||||||
|
alter table `project_type_settings` rename column `maxOpponentsOnFinalSeminar` to `max_opponents_on_final_seminar`;
|
||||||
|
alter table `project_type_settings` rename column `minFinalSeminarActiveParticipation` to `min_final_seminar_active_participation`;
|
||||||
|
alter table `project_type_settings` rename column `minOpponentsOnFinalSeminar` to `min_opponents_on_final_seminar`;
|
||||||
|
alter table `project_type_settings` rename column `minimumOppositionsToBeGraded` to `min_oppositions_to_be_graded`;
|
||||||
|
alter table `project_type_settings` rename column `minimumActiveParticipationsToBeGraded` to `min_oppositions_to_be_graded`;
|
||||||
|
|
||||||
|
alter table `project_type_settings` add constraint uk_project_type_settings_project_type_id unique(project_type_id);
|
||||||
|
|
||||||
|
|
||||||
-- activate following later
|
-- activate following later
|
||||||
/*
|
/*
|
||||||
|
-- add foreign key reference from project_type_settings to project_type
|
||||||
|
alter table `project_type_settings`
|
||||||
|
add constraint fk_project_type_settings_project_type_id
|
||||||
|
foreign key(project_type_id) references project_type(id)
|
||||||
|
on delete cascade on update cascade;
|
||||||
|
|
||||||
-- add foreign key reference from project_type_project_module to project_type
|
-- add foreign key reference from project_type_project_module to project_type
|
||||||
alter table `project_type_project_module`
|
alter table `project_type_project_module`
|
||||||
add constraint fk_project_type_project_module_project_type_id
|
add constraint fk_project_type_project_module_project_type_id
|
||||||
|
@ -66,7 +66,7 @@ public class MilestoneActivatorTest {
|
|||||||
author.setId(123L);
|
author.setId(123L);
|
||||||
|
|
||||||
ProjectType bachelor = new ProjectType(DegreeType.BACHELOR, "Bachelor", "Bachelor");
|
ProjectType bachelor = new ProjectType(DegreeType.BACHELOR, "Bachelor", "Bachelor");
|
||||||
bachelor.getProjectTypeSettings().setMinimumActiveParticipationsToBeGraded(2);
|
bachelor.getProjectTypeSettings().setMinActiveParticipationsToBeGraded(2);
|
||||||
project = Project.builder()
|
project = Project.builder()
|
||||||
.title("Project title")
|
.title("Project title")
|
||||||
.projectType(bachelor)
|
.projectType(bachelor)
|
||||||
|
@ -54,16 +54,16 @@ public class AdminProjectTypePanel extends Panel {
|
|||||||
NumberTextField<Integer> minimumOppositionsToBeGraded = new NumberTextField<>(
|
NumberTextField<Integer> minimumOppositionsToBeGraded = new NumberTextField<>(
|
||||||
"minimum_oppositions_to_be_graded",
|
"minimum_oppositions_to_be_graded",
|
||||||
LambdaModel.of(settings,
|
LambdaModel.of(settings,
|
||||||
ProjectTypeSettings::getMinimumOppositionsToBeGraded,
|
ProjectTypeSettings::getMinOppositionsToBeGraded,
|
||||||
ProjectTypeSettings::setMinimumOppositionsToBeGraded),
|
ProjectTypeSettings::setMinOppositionsToBeGraded),
|
||||||
Integer.class);
|
Integer.class);
|
||||||
minimumOppositionsToBeGraded.setMinimum(0);
|
minimumOppositionsToBeGraded.setMinimum(0);
|
||||||
add(minimumOppositionsToBeGraded);
|
add(minimumOppositionsToBeGraded);
|
||||||
NumberTextField<Integer> minimumActiveParticipationsToBeGraded = new NumberTextField<>(
|
NumberTextField<Integer> minimumActiveParticipationsToBeGraded = new NumberTextField<>(
|
||||||
"minimum_active_participations_to_be_graded",
|
"minimum_active_participations_to_be_graded",
|
||||||
LambdaModel.of(settings,
|
LambdaModel.of(settings,
|
||||||
ProjectTypeSettings::getMinimumActiveParticipationsToBeGraded,
|
ProjectTypeSettings::getMinActiveParticipationsToBeGraded,
|
||||||
ProjectTypeSettings::setMinimumActiveParticipationsToBeGraded),
|
ProjectTypeSettings::setMinActiveParticipationsToBeGraded),
|
||||||
Integer.class);
|
Integer.class);
|
||||||
minimumActiveParticipationsToBeGraded.setMinimum(0);
|
minimumActiveParticipationsToBeGraded.setMinimum(0);
|
||||||
add(minimumActiveParticipationsToBeGraded);
|
add(minimumActiveParticipationsToBeGraded);
|
||||||
|
@ -36,7 +36,7 @@ public class ProjectActiveParticipationListPanel extends GenericPanel<Project> {
|
|||||||
IModel<Integer> countRequired = model
|
IModel<Integer> countRequired = model
|
||||||
.map(Project::getProjectType)
|
.map(Project::getProjectType)
|
||||||
.map(ProjectType::getProjectTypeSettings)
|
.map(ProjectType::getProjectTypeSettings)
|
||||||
.map(ProjectTypeSettings::getMinimumActiveParticipationsToBeGraded);
|
.map(ProjectTypeSettings::getMinActiveParticipationsToBeGraded);
|
||||||
item.add(new Label("count_required", countRequired));
|
item.add(new Label("count_required", countRequired));
|
||||||
IModel<Long> countPerformed = participations.map(this::countApproved);
|
IModel<Long> countPerformed = participations.map(this::countApproved);
|
||||||
item.add(new Label("count_approved", countPerformed));
|
item.add(new Label("count_approved", countPerformed));
|
||||||
|
@ -213,8 +213,8 @@ abstract class AbstractExaminationsPanel extends GenericPanel<User> {
|
|||||||
.filter(FinalSeminarActiveParticipation::isApproved)
|
.filter(FinalSeminarActiveParticipation::isApproved)
|
||||||
.count();
|
.count();
|
||||||
final ProjectTypeSettings projectTypeSettings = project.getProjectType().getProjectTypeSettings();
|
final ProjectTypeSettings projectTypeSettings = project.getProjectType().getProjectTypeSettings();
|
||||||
final int requiredOppositions = projectTypeSettings.getMinimumOppositionsToBeGraded();
|
final int requiredOppositions = projectTypeSettings.getMinOppositionsToBeGraded();
|
||||||
final int requiredActiveParticipations = projectTypeSettings.getMinimumActiveParticipationsToBeGraded();
|
final int requiredActiveParticipations = projectTypeSettings.getMinActiveParticipationsToBeGraded();
|
||||||
return new SeminarParticipationGradingRequirements(
|
return new SeminarParticipationGradingRequirements(
|
||||||
new Requirement(requiredOppositions, completedOppositions),
|
new Requirement(requiredOppositions, completedOppositions),
|
||||||
new Requirement(requiredActiveParticipations, completedParticipations));
|
new Requirement(requiredActiveParticipations, completedParticipations));
|
||||||
|
@ -128,7 +128,7 @@ public class IndividualAuthorAssessmentPanel extends GenericPanel<User> {
|
|||||||
|
|
||||||
IModel<Integer> minimumActiveParticipationsToBeGraded = LoadableDetachableModel.of(() -> {
|
IModel<Integer> minimumActiveParticipationsToBeGraded = LoadableDetachableModel.of(() -> {
|
||||||
Project project = projectModel.getObject();
|
Project project = projectModel.getObject();
|
||||||
return project.getProjectType().getProjectTypeSettings().getMinimumActiveParticipationsToBeGraded();
|
return project.getProjectType().getProjectTypeSettings().getMinActiveParticipationsToBeGraded();
|
||||||
});
|
});
|
||||||
IModel<Integer> completedParticipations = LoadableDetachableModel.of(() -> {
|
IModel<Integer> completedParticipations = LoadableDetachableModel.of(() -> {
|
||||||
Project project = projectModel.getObject();
|
Project project = projectModel.getObject();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user