Skip to content

Commit

Permalink
SAK-50610 conversations Integrate with gradebook (#13064)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianfish authored Dec 9, 2024
1 parent 1893a2c commit 3c392db
Show file tree
Hide file tree
Showing 35 changed files with 4,483 additions and 2,114 deletions.
4 changes: 4 additions & 0 deletions conversations/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
<groupId>org.sakaiproject.scheduler</groupId>
<artifactId>scheduler-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.grading</groupId>
<artifactId>sakai-grading-api</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,11 @@ public interface ConversationsService {
ConvStatus getConvStatusForSiteAndUser(String siteId, String userId) throws ConversationsPermissionsException;
void saveConvStatus(ConvStatus convStatus) throws ConversationsPermissionsException;
Map<String, Object> getSiteStats(String siteId, Instant from, Instant to, int page, String sort) throws ConversationsPermissionsException;

/**
* Clear the posts cache for any topics graded by the supplied gradingItemId
*
* @param gradingItemId The grading item id to lookup topics against.
*/
void clearCacheForGradedTopic(Long gradingItemId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
public enum Permissions {
ROLETYPE_INSTRUCTOR("conversations.roletype.instructor"),
MODERATE("conversations.moderate"),
GRADE("conversations.grade"),
QUESTION_CREATE("conversations.question.create"),
DISCUSSION_CREATE("conversations.discussion.create"),
TOPIC_UPDATE_OWN("conversations.topic.update.own"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.sakaiproject.conversations.api.model.Metadata;
import org.sakaiproject.conversations.api.model.ConversationsPost;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.grading.api.GradeDefinition;

import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -79,12 +80,14 @@ public class PostTransferBean implements Entity {
public boolean canViewUpvotes;
public boolean canReact;
public boolean canModerate;
public boolean canGrade;
public boolean isInstructor;
public boolean late;

public String url;
public String portalUrl;
public String reference;
public GradeDefinition grade;

public void clear() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.sakaiproject.conversations.api.TopicType;
import org.sakaiproject.conversations.api.TopicVisibility;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.grading.api.GradeDefinition;

import java.time.Instant;
import java.util.ArrayList;
Expand Down Expand Up @@ -81,6 +82,7 @@ public class TopicTransferBean implements Entity {
public boolean hiddenByDate;
public boolean lockedByDate;
public int upvotes;
public Long gradingItemId;

public String creatorDisplayName;
public boolean canEdit;
Expand All @@ -101,6 +103,12 @@ public class TopicTransferBean implements Entity {
public String portalUrl;
public String reference;

// Just a message. Not state.
public boolean graded;
public boolean createGradingItem;
public double gradingPoints;
public long gradingCategory;

public static TopicTransferBean of(ConversationsTopic topic) {

TopicTransferBean topicBean = new TopicTransferBean();
Expand Down Expand Up @@ -134,6 +142,7 @@ public static TopicTransferBean of(ConversationsTopic topic) {
topicBean.allowAnonymousPosts = topic.getAllowAnonymousPosts();
topicBean.groups = topic.getGroups();
topicBean.upvotes = topic.getUpvotes();
topicBean.gradingItemId = topic.getGradingItemId();

Instant now = Instant.now();

Expand Down Expand Up @@ -177,6 +186,7 @@ public ConversationsTopic asTopic() {
topic.setAllowAnonymousPosts(this.allowAnonymousPosts);
topic.setDueDateCalendarEventId(this.dueDateCalendarEventId);
topic.setShowMessageScheduleId(this.showMessageScheduleId);
topic.setGradingItemId(this.gradingItemId);

return topic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ public class ConversationsTopic implements PersistableEntity<String> {
@Column(name = "UPVOTES")
private Integer upvotes = 0;

@Column(name = "GRADING_ITEM_ID")
private Long gradingItemId;

@Embedded
private Metadata metadata;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ public interface ConversationsTopicRepository extends SpringCrudRepository<Conve
List<ConversationsTopic> findByTags_Id(Long tagId);
Long countBySiteIdAndMetadata_Creator_Id(String siteId, String creatorId);
Integer lockBySiteId(String siteId, Boolean locked);
List<ConversationsTopic> findTopicsByGradingItemId(Long gradingItemId);
}
10 changes: 10 additions & 0 deletions conversations/api/src/main/resources/conversations.properties
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ confirm_comment_delete=Are you sure you want to delete this comment?
confirm_post_delete=Are you sure you want to delete this post?
confirm_topic_delete=Are you sure you want to delete this topic?
create_new=Create new topic
currently=Currently
date=Date:
delete=Delete
delete_this_comment=Delete this comment.
Expand Down Expand Up @@ -98,6 +99,10 @@ filter_questions=Filter: questions
filter_unviewed=Filter: unviewed
general_settings=General Settings
grading_and_duedate=Due Date
grade_posts_by=Grade posts by {}
grade_submitted=Grade submitted
grade_warning=You need to enter a grade or a comment
graded=Graded for {} points
groups=Only members of selected groups
hidden_message=This post has been hidden.
hide=Hide
Expand All @@ -117,6 +122,7 @@ lock=Lock
lock_topic_tooltip=Lock this topic
lock_this_site=Prevent any more authoring on this site
lockdate_picker_tooltip=Lock date picker
max_of=Max of
manage_tags=Manage Tags
moderator_hidden_message=This post has been hidden. You can see the content because you are a moderator.
moderator_topic_locked=This topic is locked and no changes can be made. Click 'Unlock' in the options menu to unlock it.
Expand All @@ -142,6 +148,8 @@ pin_tooltip=Pin this topic. This will pin the topic towards the top of any user'
pinned=Pinned
pinned_text=Keep at top of list
pinned_tooltip=This topic has been pinned
grade_comment_label=Comment:
grade_points_label=Points:
post_anonymously=Post anonymously
post_before_viewing_label=Student must post before reading responses
post_before_viewing_message=You must post a response before viewing additional responses
Expand Down Expand Up @@ -187,6 +195,7 @@ sort_by_reactions_made=Sort by the number of reactions made
sort_by_viewed_topics=Sort by the number of topics viewed
showdate_picker_tooltip=Show date picker
statistics=Statistics
submit_grade=Submit Grade
summary=Title
tag=Tag:
tag_any=Tag: any
Expand Down Expand Up @@ -229,6 +238,7 @@ why_not_create_one=Go ahead and create one!

perm-conversations.roletype.instructor=This role counts as an instructor
perm-conversations.moderate=Moderate topics and posts
perm-conversations.grade=Grade posts
perm-conversations.topic.create=Create a topic
perm-conversations.discussion.create=Create a discussion
perm-conversations.question.create=Create a question
Expand Down
8 changes: 8 additions & 0 deletions conversations/impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
<groupId>org.sakaiproject.conversations</groupId>
<artifactId>sakai-conversations-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.grading</groupId>
<artifactId>sakai-grading-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.edu-services.sections</groupId>
<artifactId>sections-api</artifactId>
</dependency>
<dependency>
<groupId>org.sakaiproject.scheduler</groupId>
<artifactId>scheduler-api</artifactId>
Expand Down
Loading

0 comments on commit 3c392db

Please sign in to comment.