Permalink
Browse files

Add top match and highest match percentage to Lichen main page (#2626)

* add total match and highest percentage match

* remove link to plagiarism result if no match
  • Loading branch information...
tushargr authored and bmcutler committed Aug 2, 2018
1 parent 995aeef commit c75ade7210fc4e7794892c19417edc031f74259e
Showing with 25 additions and 1 deletion.
  1. +25 −1 site/app/views/admin/PlagiarismView.php
@@ -88,10 +88,31 @@ public function plagiarismMainPage($semester, $course, $gradeables_with_plagiari
#no lichen job
else {
$return .= <<<HTML
$ranking_file_path= "/var/local/submitty/courses/".$semester."/".$course."/lichen/ranking/".$id.".txt";
if(file_get_contents($ranking_file_path) == "") {
$matches_and_topmatch= "0 students matched, N/A top match";
$return .= <<<HTML
<tr>
<td>$title
</td>
HTML;
}
else {
$content =file_get_contents($ranking_file_path);
$content = trim(str_replace(array("\r", "\n"), '', $content));
$rankings = preg_split('/ +/', $content);
$rankings = array_chunk($rankings,3);
$matches_and_topmatch = count($rankings)." students matched, ".$rankings[0][0]." top match";
$return .= <<<HTML
<tr>
<td><a href="{$this->core->buildUrl(array('component' => 'admin', 'semester' => $semester, 'course'=> $course, 'page' => 'plagiarism', 'action' => 'show_plagiarism_result', 'gradeable_id' => $id))}">$title</a>
</td>
HTML;
}
$return .= <<<HTML
<td><a href="{$this->core->buildUrl(array('component' => 'admin', 'semester' => $semester, 'course'=> $course, 'page' => 'plagiarism', 'action' => 'edit_plagiarism_saved_config', 'gradeable_id' => $id))}"><i class="fa fa-pencil" aria-hidden="true"></i></a>
</td>
<td><a href="{$this->core->buildUrl(array('component' => 'admin', 'semester' => $semester, 'course'=> $course, 'page' => 'plagiarism', 'action' => 're_run_plagiarism', 'gradeable_id' => $id))}"><i class="fa fa-refresh" aria-hidden="true"></i></a>
@@ -104,6 +125,9 @@ public function plagiarismMainPage($semester, $course, $gradeables_with_plagiari
<td>
$students students, $submissions submissions
</td>
<td>
$matches_and_topmatch
</td>
<td>
<label><input type="checkbox" onclick='window.location.href = buildUrl({"component":"admin", "page" :"plagiarism", "course":"{$course}", "semester": "{$semester}", "action": "toggle_nightly_rerun", "gradeable_id":"{$id}"});' {$night_rerun_status} >Nightly Re-run </label>
</td>

0 comments on commit c75ade7

Please sign in to comment.