Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20210319.sql =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20210319.sql (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch20210319.sql (revision 0c2e20bdef5ea03a9b23625f92f4717500c4f0b7) @@ -0,0 +1,15 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +-- Put all sql statements below here + +--LDEV-5155 Add new rating style, rubrics + +ALTER TABLE lams_rating_criteria ADD COLUMN rating_criteia_group_id MEDIUMINT UNSIGNED AFTER rating_criteria_type_id; + +-- Put all sql statements above here + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; Index: lams_common/src/java/org/lamsfoundation/lams/rating/model/RatingCriteria.java =================================================================== diff -u -r96068ffc66514c1d25e9adeb96acfa164ab29dd5 -r0c2e20bdef5ea03a9b23625f92f4717500c4f0b7 --- lams_common/src/java/org/lamsfoundation/lams/rating/model/RatingCriteria.java (.../RatingCriteria.java) (revision 96068ffc66514c1d25e9adeb96acfa164ab29dd5) +++ lams_common/src/java/org/lamsfoundation/lams/rating/model/RatingCriteria.java (.../RatingCriteria.java) (revision 0c2e20bdef5ea03a9b23625f92f4717500c4f0b7) @@ -46,24 +46,29 @@ /** * Base class for all RatingCriterias. If you add another subclass, you must update * RatingCriteriaDAO.getRatingCriteriaByRatingCriteriaId() and add a ACTIVITY_TYPE constant. - * + * * Criteria Styles: - * - * Comment: This supports the old style Peer Review comments, with every reviewer leaving one comment for each item/user - * being reviewed for a set of (star) criteria. - * Not support in the in Peer Review once it supports Ranking, Hedging, etc but kept for compatibility with existing data. - * Could be included in new style Peer Review with user interface changes. - * - * Star: The original style of comment, with up to 5 stars being used. For every star criteria, each reviewer leaves - * one star rating (in lams_rating) for each item/user and possibly one comment (in lams_rating_comment) for each item/user. - * - * Ranking: Ordering of the top 1, top 2, top 3, top 4, top 5 or all items/users. For every ranking criteria, each reviewer leaves - * one ranking (in lams_rating) for [ 1/2/3/4/5/all ] items/users and no comments. - * - * Hedging: Allocating out marks across items/users. For every hedging criteria, each reviewer leaves - * one ranking (in lams_rating) for 1 or more items/users and 0 or 1 justification comment overall (in lams_rating_comment). - * That is, for Hedging a reviewer makes one justification comment, whereas in Star the reviewer makes one comment for each user/item being reviewed. - * + * + * Comment: This supports the old style Peer Review comments, with every reviewer leaving one comment for each item/user + * being reviewed for a set of (star) criteria. + * Not support in the in Peer Review once it supports Ranking, Hedging, etc but kept for compatibility with existing + * data. + * Could be included in new style Peer Review with user interface changes. + * + * Star: The original style of comment, with up to 5 stars being used. For every star criteria, each reviewer leaves + * one star rating (in lams_rating) for each item/user and possibly one comment (in lams_rating_comment) for each + * item/user. + * + * Ranking: Ordering of the top 1, top 2, top 3, top 4, top 5 or all items/users. For every ranking criteria, each + * reviewer leaves + * one ranking (in lams_rating) for [ 1/2/3/4/5/all ] items/users and no comments. + * + * Hedging: Allocating out marks across items/users. For every hedging criteria, each reviewer leaves + * one ranking (in lams_rating) for 1 or more items/users and 0 or 1 justification comment overall (in + * lams_rating_comment). + * That is, for Hedging a reviewer makes one justification comment, whereas in Star the reviewer makes one comment for + * each user/item being reviewed. + * */ @Entity @@ -99,23 +104,30 @@ public static final String I18N_DESCRIPTION = "rating.criteria.description"; public static final String I18N_HELP_TEXT = "rating.criteria.helptext"; - /** What style to use for doing the rating? Stored in Int member - * If Style = RATING_STYLE_COMMENT then the entry is for a comment criteria, with the data in RatingComment. - * If Style = RATING_STYLE_STAR then maxRating is 5, which lines up with the number of stars and comments are allowed. + /** + * What style to use for doing the rating? Stored in Int member + * If Style = RATING_STYLE_COMMENT then the entry is for a comment criteria, with the data in RatingComment. + * If Style = RATING_STYLE_STAR then maxRating is 5, which lines up with the number of stars and comments are + * allowed. * If Style = RATING_STYLE_RANKING then maxRating will be 1 through 5 or -1 for rank all. - * If Style = RATING_STYLE_HEDGING then maxRating contains the sum total mark to which the hedged ratings should add up. - * The comments table is also used to store the rating justification for hedging. */ + * If Style = RATING_STYLE_HEDGING then maxRating contains the sum total mark to which the hedged ratings should add + * up. + * If Style = RATING_STYLE_RUBRICS then maxRating is the same as number of columns, starting with 1 + * The comments table is also used to store the rating justification for hedging. + */ public static final int RATING_STYLE_COMMENT = 0; public static final int RATING_STYLE_STAR = 1; public static final int RATING_STYLE_RANKING = 2; public static final int RATING_STYLE_HEDGING = 3; + public static final int RATING_STYLE_RUBRICS = 4; // The star rating can never be higher than RATING_STYLE_STAR_DEFAULT_MAX - it is capped in RatingService.rateItem, RatingService.rateItems - public static final int RATING_STYLE_STAR_DEFAULT_MAX = 5; - public static final float RATING_STYLE_STAR_DEFAULT_MAX_AS_FLOAT = 5f; + public static final int RATING_STYLE_STAR_DEFAULT_MAX = 5; + public static final float RATING_STYLE_STAR_DEFAULT_MAX_AS_FLOAT = 5f; public static final int RATING_STYLE_RANKING_DEFAULT_MAX = 5; + public static final int RATING_STYLE_RUBRICS_DEFAULT_MAX = 5; public static final int RATING_RANK_ALL = -1; - + // --------------------------------------------------------------------- // Instance variables // --------------------------------------------------------------------- @@ -139,6 +151,9 @@ @Column(name = "rating_criteria_type_id", insertable = false, updatable = false) private Integer ratingCriteriaTypeId; + @Column(name = "rating_criteia_group_id") + private Integer ratingCriteriaGroupId; // ID shared between all criteria in the same group, for example all rows in the same rubrics criteria + @Column(name = "comments_enabled") private boolean commentsEnabled; // comments for RATING_STYLE_COMMENT, RATING_STYLE_STAR justification for RATING_STYLE_HEDGING @@ -147,17 +162,16 @@ @Column(name = "rating_style") private Integer ratingStyle; // see comments above for RATING_STYLE - + @Column(name = "max_rating") private Integer maxRating; // see comments above for RATING_STYLE - + @Column(name = "minimum_rates") private Integer minimumRates; // Minimum number of people for whom one user may rate this criteria. Used for RATING_STYLE_STAR. @Column(name = "maximum_rates") private Integer maximumRates; // Minimum number of people for whom one user may rate this criteria. Used for RATING_STYLE_STAR. - // --------------------------------------------------------------------- // Object constructors // --------------------------------------------------------------------- @@ -168,7 +182,8 @@ /** full constructor */ public RatingCriteria(Long ratingCriteriaId, String title, Integer orderId, Date createDateTime, - Integer ratingCriteriaTypeId, Integer ratingStyle, Integer maxRating, Integer minimumRates, Integer maximumRates) { + Integer ratingCriteriaTypeId, Integer ratingStyle, Integer maxRating, Integer minimumRates, + Integer maximumRates) { this.ratingCriteriaId = ratingCriteriaId; this.title = title; this.orderId = orderId; @@ -309,11 +324,12 @@ case RatingCriteria.RATING_STYLE_HEDGING: case RatingCriteria.RATING_STYLE_COMMENT: return 0; - default: - return null; + case RatingCriteria.RATING_STYLE_RUBRICS: + return RATING_STYLE_RUBRICS_DEFAULT_MAX; } + return null; } - + // --------------------------------------------------------------------- // RatingCriteria Type checking methods // --------------------------------------------------------------------- @@ -374,40 +390,47 @@ return getRatingStyle().intValue() == RatingCriteria.RATING_STYLE_HEDGING; } + /** + * Is it Rubrics? + */ + public boolean isRubricsStyleRating() { + return getRatingStyle().intValue() == RatingCriteria.RATING_STYLE_RUBRICS; + } + // --------------------------------------------------------------------- // Data Transfer object creation methods // --------------------------------------------------------------------- public Integer getRatingStyle() { - return ratingStyle; + return ratingStyle; } public void setRatingStyle(Integer ratingStyle) { - this.ratingStyle = ratingStyle; + this.ratingStyle = ratingStyle; } public Integer getMaxRating() { - return maxRating; + return maxRating; } public void setMaxRating(Integer maxRating) { - this.maxRating = maxRating; + this.maxRating = maxRating; } public Integer getMinimumRates() { - return minimumRates; + return minimumRates; } public void setMinimumRates(Integer minimumRates) { - this.minimumRates = minimumRates; + this.minimumRates = minimumRates; } public Integer getMaximumRates() { - return maximumRates; + return maximumRates; } public void setMaximumRates(Integer maximumRates) { - this.maximumRates = maximumRates; + this.maximumRates = maximumRates; } @Override Index: lams_common/src/java/org/lamsfoundation/lams/rating/model/RubricsColumnHeader.java =================================================================== diff -u --- lams_common/src/java/org/lamsfoundation/lams/rating/model/RubricsColumnHeader.java (revision 0) +++ lams_common/src/java/org/lamsfoundation/lams/rating/model/RubricsColumnHeader.java (revision 0c2e20bdef5ea03a9b23625f92f4717500c4f0b7) @@ -0,0 +1,64 @@ +package org.lamsfoundation.lams.rating.model; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +/** + * The actual rating left by a user + */ +@Entity +@Table(name = "lams_rating_rubrics_column_header") +public class RubricsColumnHeader implements java.io.Serializable, Cloneable { + + private static final long serialVersionUID = 5230206250617216351L; + + @Id + @Column + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long uid; + + @Column(name = "rubrics_id") + private Integer rubricsId; + + @Column(name = "display_order") + private Integer displayOrder; + + @Column + private String title; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public Integer getRubricsId() { + return rubricsId; + } + + public void setRubricsId(Integer rubricsId) { + this.rubricsId = rubricsId; + } + + public Integer getDisplayOrder() { + return displayOrder; + } + + public void setDisplayOrder(Integer displayOrder) { + this.displayOrder = displayOrder; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } +} \ No newline at end of file Index: lams_tool_preview/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -raa932dd995a61adeed918456c6257a4a9a9cea74 -r0c2e20bdef5ea03a9b23625f92f4717500c4f0b7 --- lams_tool_preview/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision aa932dd995a61adeed918456c6257a4a9a9cea74) +++ lams_tool_preview/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 0c2e20bdef5ea03a9b23625f92f4717500c4f0b7) @@ -90,6 +90,7 @@ label.rating.style.ranking = Ranking label.rating.style.hedging = Hedging label.rating.style.comment = Comment +label.rating.style.rubrics = Rubrics label.rating.all = ALL label.rating.author.justify = Ask for hedging justification? label.rating.learner.hedge.assign.marks = Assign marks to answers. Max possible mark: 10 Index: lams_tool_preview/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag =================================================================== diff -u -rbad085b1dd5071ed2165bb83be9c41365bb0135a -r0c2e20bdef5ea03a9b23625f92f4717500c4f0b7 --- lams_tool_preview/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision bad085b1dd5071ed2165bb83be9c41365bb0135a) +++ lams_tool_preview/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision 0c2e20bdef5ea03a9b23625f92f4717500c4f0b7) @@ -104,11 +104,15 @@ + + + -