Skip to content

Commit

Permalink
TII-259 TurnitinOC: auto exclude self matching scope (sakaiproject#6850)
Browse files Browse the repository at this point in the history
  • Loading branch information
baholladay authored and ern committed May 1, 2019
1 parent 1262a76 commit 70825ec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
13 changes: 11 additions & 2 deletions content-review/impl/turnitin-oc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is the Turnitin Originality Check content review implementation which is for use with those that use the TurnitinOC service.

### Configuration

```
contentreview.enabledProviders=TurnitinOC
contentreview.defaultProvider=TurnitinOC
assignment.useContentReview=true
Expand Down Expand Up @@ -94,4 +94,13 @@ assignment.useContentReview=true
# 2=At Due Date
# default: turnitin.report_gen_speed.setting.value=0
# Please make sure the property 'version.sakai' is set correctly
# turnitin.oc.auto_exclude_self_matching_scope
# Allows you to set the default self matching exclude scope for all submissions
# ALL (Exclude all self matching submissions from Similarity Report)
# NONE (Exclude no self matching submissions from Similarity Report)
# GROUP (Exclude all self matching submissions in current assignment from Similarity Report)
# GROUP_CONTEXT (Exclude all self matching submissions in current course from Similarity Report)
# default: GROUP
# Please make sure the property 'version.sakai' is set correctly
```
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,13 @@ public class ContentReviewServiceTurnitinOC extends BaseContentReviewService {
private HashMap<String, String> CONTENT_UPLOAD_HEADERS = new HashMap<String, String>();
private HashMap<String, String> WEBHOOK_SETUP_HEADERS = new HashMap<String, String>();

private enum AUTO_EXCLUDE_SELF_MATCHING_SCOPE{
ALL,
NONE,
GROUP,
GROUP_CONTEXT
}

@Setter
private MemoryService memoryService;
//Caches requests for instructors so that we don't have to send a request for every student
Expand Down Expand Up @@ -248,14 +255,20 @@ public class ContentReviewServiceTurnitinOC extends BaseContentReviewService {
private final String PROP_ACCEPTABLE_FILE_TYPES = "turnitin.acceptable.file.types";

private final String KEY_FILE_TYPE_PREFIX = "file.type";

private String autoExcludeSelfMatchingScope;

public void init() {
EULA_CACHE = memoryService.createCache("org.sakaiproject.contentreview.turnitin.oc.ContentReviewServiceTurnitinOC.LATEST_EULA_CACHE", new SimpleConfiguration<>(10000, 24 * 60 * 60, -1));
// Retrieve Service URL and API key
serviceUrl = serverConfigurationService.getString("turnitin.oc.serviceUrl", "");
apiKey = serverConfigurationService.getString("turnitin.oc.apiKey", "");
// Retrieve Sakai Version if null set default
sakaiVersion = Optional.ofNullable(serverConfigurationService.getString("version.sakai", "")).orElse("UNKNOWN");
sakaiVersion = serverConfigurationService.getString("version.sakai", "UNKNOWN");
autoExcludeSelfMatchingScope =Arrays.stream(AUTO_EXCLUDE_SELF_MATCHING_SCOPE.values())
.filter(e -> e.name().equalsIgnoreCase(serverConfigurationService.getString("turnitin.oc.auto_exclude_self_matching_scope")))
.findAny().orElse(AUTO_EXCLUDE_SELF_MATCHING_SCOPE.GROUP).name();
log.info("Exclude Scope: " + autoExcludeSelfMatchingScope);

// Populate base headers that are needed for all calls to TCA
BASE_HEADERS.put(HEADER_NAME, INTEGRATION_FAMILY);
Expand Down Expand Up @@ -656,6 +669,7 @@ private void generateSimilarityReport(String reportId, String assignmentRef, boo
Map<String, Object> reportData = new HashMap<String, Object>();
Map<String, Object> generationSearchSettings = new HashMap<String, Object>();
generationSearchSettings.put("search_repositories", repositories);
generationSearchSettings.put("auto_exclude_self_matching_scope", autoExcludeSelfMatchingScope);
reportData.put("generation_settings", generationSearchSettings);

Map<String, Object> viewSettings = new HashMap<String, Object>();
Expand Down

0 comments on commit 70825ec

Please sign in to comment.