Skip to content

Commit

Permalink
SAK-43155: Worklog tab in assignments (sakaiproject#8996)
Browse files Browse the repository at this point in the history
* SAK-43155: Worklog tab in assignments

* SAK-43155: Resolved Codacy Issues

* SAK-43155: solving timesheet calendar not saving picked date

* SAK-43155 fixing core comments

* SAK-43155 fixing more core comments

* fixing json serializer error messages

* SAK-43155: Resolve Issues Hibernate

* SAK-43155: Resolved Issue sakai-reference

* SAK-43155: Resolved test JUNIT

* SAK-43155: Resolved *.vm issues

* correctTime -> timeHasCorrectFormat

* regTime -> duration. No el nombre de la columna de BBDD, sino la variable relacionada

* asnComment -> comment. No el nombre de la columna de BBDD, sino la variable relacionada

* Cambio de String a Long

* Mover pattern al constructor

* if para evitar NPE

* Cambios en columnas de BBDD

* Quitar findFirst()

* AssignmentService. Nomenclatura de metodos y context -> siteId

* deleteTimesheet. se obtiene contexto desde timeSheet antes de revisar permisos

* Eliminar getSubmissionSubmitter y findSubmissionSubmitter

* Cambios de Fish en javascript

* ultimos retoques

* SAK-43155: Resolved ALL remaining issues

* SAK-43155: Resolved TEST problems

* Update assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java

* Update assignment/tool/src/webapp/js/assignments.js

* Update assignment/tool/src/webapp/js/studentViewSubmission.js

* Update assignment/impl/src/java/org/sakaiproject/assignment/impl/AssignmentServiceImpl.java

* changes tuesday sept 28

Co-authored-by: Victor <[email protected]>
Co-authored-by: victorGomollon <[email protected]>
Co-authored-by: victorGomollon <[email protected]>
Co-authored-by: Adrian Fish <[email protected]>
  • Loading branch information
5 people authored Sep 29, 2021
1 parent f3c8939 commit 27d0a96
Show file tree
Hide file tree
Showing 46 changed files with 2,037 additions and 126 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -336,4 +336,6 @@ public enum SubmissionStatus {
*/
public static final String SAK_PROP_ALLOW_LINK_TO_EXISTING_GB_ITEM = "assignment.allowLinkToExistingGBItem";
public static final boolean SAK_PROP_ALLOW_LINK_TO_EXISTING_GB_ITEM_DFLT = true;

public static final String ASSIGNMENT_INPUT_ADD_SUBMISSION_TIME_SPENT = "value_ASSIGNMENT_INPUT_ADD_SUBMISSION_TIME_SPENT";
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.sakaiproject.assignment.api.model.Assignment;
import org.sakaiproject.assignment.api.model.AssignmentSubmission;
import org.sakaiproject.assignment.api.model.AssignmentSubmissionSubmitter;
import org.sakaiproject.assignment.api.model.AssignmentTimeSheet;
import org.sakaiproject.content.api.ContentResource;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.entity.api.EntityProducer;
Expand Down Expand Up @@ -817,6 +818,16 @@ public String getDeepLinkWithPermissions(String context, String assignmentId, bo
*/
public List<MultiGroupRecord> checkSubmissionForUsersInMultipleGroups(String siteId, Group submissionGroup, Collection<Group> asnGroups);

public boolean timeHasCorrectFormat(String timeSheet);

public AssignmentTimeSheet getTimeSheet(Long timeSheetId) throws PermissionException;

public void setTimeSheet(AssignmentTimeSheet timeSheet, String siteId) throws PermissionException;

public void deleteTimeSheet(AssignmentTimeSheet timeSheet) throws PermissionException;

public String getTimeSpent(AssignmentSubmission submission);

/**
* Returns true if the content review implementation successfully created the assignment
* @param a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ public final class AssignmentServiceConstants {
* Security lock for adding an assignment.
*/
public static final String SECURE_ADD_ASSIGNMENT = "asn.new";
/**
* Security lock for adding an timesheet.
*/
public static final String SECURE_ADD_TIMESHEET = "asn.new.timeSheet";
/**
* Security lock for adding an assignment submission.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ public class Assignment {
@Column(name = "CONTENT_REVIEW")
private Boolean contentReview = Boolean.FALSE;

@Column(name = "IS_REQUIRED_ESTIMATE", length = 1, nullable = false)
private Boolean reqEstimate = Boolean.FALSE;

@Column(name = "ESTIMATE", length = 255)
private String estimate;

@Column(name = "CONTENT_ID")
private Integer contentId = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;

import com.fasterxml.jackson.annotation.JsonManagedReference;

/**
* Defines a relation between a submission and the submission's submitters.
* <br/> - A submitter can have its own grade separate from the grade of the submission,
Expand Down Expand Up @@ -83,4 +92,13 @@ public class AssignmentSubmissionSubmitter {
@Lob
@Column(name = "FEEDBACK", length = 65535)
private String feedback;

@Column(name = "TIME_SPENT", length = 255)
private String timeSpent;

@OneToMany(mappedBy = "submitter", cascade = CascadeType.ALL, orphanRemoval = true)
@OrderBy("regDate ASC")
@JsonManagedReference
private Set<AssignmentTimeSheet> timeSheet = new HashSet<>();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright (c) 2003-2017 The Apereo Foundation
*
* Licensed under the Educational Community License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/ecl2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sakaiproject.assignment.api.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.time.Instant;

/**
* Defines a relation between a submission and the submission's submitters.
* <br/> - A submitter can have its own grade separate from the grade of the submission,
* useful in providing user with different grades in group submissions.
* <br/> - A submitter can have its own feedback separate from the feedback of the submission,
* useful when different feedback is needed in group submissions
* <p>
* <b>Constraints</b>
* <br/>- submission and submitter are unique,
* meaning a user can't be a submitter more than once on a submission.
* Notice that equals and hashcode also reflect this relationship.
*/
@Entity
@Table(name = "ASN_TIMESHEET")
@Data
@NoArgsConstructor
@ToString(exclude = {"submitter"})
@EqualsAndHashCode(of = "id")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class AssignmentTimeSheet {

@Id
@Column(name = "ID")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "seq_id_asn_timesheet")
@SequenceGenerator(name = "seq_id_asn_timesheet", sequenceName = "SEQ_ID_ASN_TIMESHEET_S")
private Long id;


@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "SUBMITTER_ID", nullable = false)
@JsonBackReference
private AssignmentSubmissionSubmitter submitter;

@Type(type = "org.hibernate.type.InstantType")
@Column(name = "REG_DATE", nullable = false)
private Instant regDate;

@Column(name = "DURATION", length = 255)
private String duration;

@Column(name = "COMMENT", length = 4096)
private String comment;
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.sakaiproject.assignment.api.model.Assignment;
import org.sakaiproject.assignment.api.model.AssignmentSubmission;
import org.sakaiproject.assignment.api.model.AssignmentSubmissionSubmitter;
import org.sakaiproject.assignment.api.model.AssignmentTimeSheet;
import org.sakaiproject.serialization.SerializableRepository;

/**
Expand Down Expand Up @@ -91,4 +92,13 @@ AssignmentSubmission newSubmission(String assignmentId,
String findAssignmentIdForGradebookLink(String context, String linkId);

Collection<String> findGroupsForAssignmentById(String assignmentId);

public void newAssignmentTimeSheet(AssignmentTimeSheet timeSheet);

public boolean existsAssignmentTimeSheet(AssignmentTimeSheet timeSheet);

public AssignmentTimeSheet findTimeSheet(Long timeSheetId);

public void deleteAssignmentTimeSheet(AssignmentTimeSheet timeSheet);

}
49 changes: 49 additions & 0 deletions assignment/api/src/resources/assignment.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,55 @@ email.reminder.andhours=and {0} hours.
email.reminder.hours={0} hours.
email.reminder.days={0} days

gen.estimate=Estimate
gen.estimatedselfempl=Estimated self-employed work
gen.isestimate=Include estimated time to complete the assigment
gen.reqestimate=Mandatory
gen.timestimate=Indicate the estimated time
timeempty=Please specify the estimated duration of the assigment.
timeformat=The format of the estimated time of the task is not correct. This must be XXh XXm.
gen.sorbytime=Sort by time estimate
gen.timesheet.instructor=Avg. submission time / Estimated
gen.timesheet.student=Time spent / Estimated
gen.spenttime=Time spent
gen.sorbyspenttime=Sort by time spent
gen.totaltimespent=Total time spent on the task
gen.totaltimespentconfirm=Total time spent on the task:
gen.useimputedtime=Use imputted time in
gen.notimeimputted=There's no imputted time in
gen.notimeimputted.enter=, record the time spent.
gen.noestimate=Without record

#Timesheet
ts.tab.assignment=Assignment
ts.tab.timesheet=Time Sheet
ts.btn.add.record=Add record
ts.btn.del.record=Remove record
ts.msg.no.timesheet.record=There are no timesheet records.
ts.title.timesheet=Timesheet
ts.table.tab.date=Date
ts.table.tab.comment=Comment
ts.table.tab.time=Time
ts.table.tab.del=Delete
ts.modal.new=New record
ts.modal.msg.err=Format error in time spent field
ts.modal.field.date=Date:
ts.modal.field.comment=Comment:
ts.modal.field.tspent=Time spent:
ts.modal.field.tspent.format=XXh YYm
ts.modal.btn.save=Save

ts.add.err.userId=You need to be logged in to add time sheet register
ts.add.err.assignmentId=You need to supply the assignmentId and ref
ts.add.err.regDate=You must set a timesheet date
ts.add.err.regComment=You need to fill the comment field
ts.add.err.duration=The format of the estimated time of the task is not correct. This must be XXh XXm.
ts.add.err.permission=You can't modify this sumbitter
ts.add.err.submitter=You submitter does not exist.
ts.rem.err.userId=You need to be logged in to add time sheet register
ts.rem.err.empty=Selected time sheet must be provided
ts.rem.err.submitterId=You need to supply the submissionId and ref
ts.rem.err.permission=You can't modify this sumbitter

defaultGrade.notGrade=a Grade
defaultGrade.notSubmit=Not Submit
Expand Down
52 changes: 51 additions & 1 deletion assignment/api/src/resources/assignment_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1155,5 +1155,55 @@ email.reminder.andhours=y {0} horas.
email.reminder.hours={0} horas.
email.reminder.days={0} d\u00edas

gen.estimate=Estimado
gen.estimatedselfempl=Trabajo aut\u00F3nomo estimado
gen.isestimate=Incluir tiempo aut\u00F3nomo del alumno en realizar la tarea
gen.reqestimate=Obligatoriedad
gen.timestimate=Indique el tiempo estimado
timeempty=Por favor, especifique la duraci\u00f3n estimada de la tarea.
timeformat=El formato del tiempo estimado de la tarea no es el correcto. Este debe de ser XXh XXm.
gen.sorbytime=Ordenar por tiempo estimado
gen.timesheet.instructor=T. Medio env\u00EDos / Estimaci\u00F3n
gen.timesheet.student=T. Dedicado / Estimado
gen.spenttime=Tiempo dedicado
gen.sorbyspenttime=Ordenar por tiempo dedicado
gen.totaltimespent=Tiempo de trabajo aut\u00F3nomo dedicado
gen.totaltimespentconfirm=Tiempo de trabajo aut\u00F3nomo dedicado:
gen.useimputedtime=Utilizar el tiempo imputado en
gen.notimeimputted=No hay tiempo registrado en
gen.notimeimputted.enter=, registre manualmente el tiempo dedicado.
gen.noestimate=Sin registro

#Timesheet
ts.tab.assignment=Env\u00EDo
ts.tab.timesheet=Bit\u00e1cora
ts.btn.add.record=A\u00F1adir registro
ts.btn.del.record=Eliminar registro
ts.msg.no.timesheet.record=No hay registros de bit\u00e1cora.
ts.title.timesheet=Bit\u00e1cora
ts.table.tab.date=Fecha
ts.table.tab.comment=Comentario
ts.table.tab.time=Tiempo
ts.table.tab.del=Borrar
ts.modal.new=Nuevo registro
ts.modal.msg.err=Error de formato en el campo tiempo empleado.
ts.modal.field.date=Fecha:
ts.modal.field.comment=Comentario:
ts.modal.field.tspent=Tiempo dedicado:
ts.modal.field.tspent.format=XXh YYm
ts.modal.btn.save=Guardar

ts.add.err.userId=Debe estar registrado para a\u00F1adir registros de bit\u00e1cora
ts.add.err.assignmentId=Debe proporcionar un assignmentId y ref
ts.add.err.regDate=Debe especificar una fecha de bit\u00e1cora
ts.add.err.regComment=Necesita completar el campo comentario
ts.add.err.duration=El formato del tiempo estimado de la tarea no es el correcto. Este debe de ser XXh XXm.
ts.add.err.permission=Usted no puede modificar el sumbitter
ts.add.err.submitter=El submitter asociado no existe.
ts.rem.err.userId=Debe estar registrado para eliminar registros de bit\u00e1cora
ts.rem.err.empty=Debe proporcionar la bit\u00e1cora seleccionada
ts.rem.err.submitterId=Debe proporcionar un submissionId y ref
ts.rem.err.permission=Usted no puede modificar el sumbitter

defaultGrade.notGrade=Sin calificar
defaultGrade.notSubmit=Sin env\u00EDo
defaultGrade.notSubmit=Sin env\u00EDo
Loading

0 comments on commit 27d0a96

Please sign in to comment.