-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from jheinzel/quality-of-life
jPlag parser logs, plagiarism folder moved, ChooseFeedbackCommand refactored
- Loading branch information
Showing
22 changed files
with
377 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 13 additions & 7 deletions
20
src/main/kotlin/at/fhooe/hagenberg/tutorbot/commands/PlagiarismCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,36 @@ | ||
package at.fhooe.hagenberg.tutorbot.commands | ||
|
||
import at.fhooe.hagenberg.tutorbot.components.ConfigHandler | ||
import at.fhooe.hagenberg.tutorbot.components.PlagiarismChecker | ||
import at.fhooe.hagenberg.tutorbot.util.exitWithError | ||
import at.fhooe.hagenberg.tutorbot.util.promptTextInput | ||
import picocli.CommandLine.Command | ||
import java.io.File | ||
import java.nio.file.Path | ||
import javax.inject.Inject | ||
|
||
@Command( | ||
name = "plagiarism", | ||
description = ["Checks downloaded submissions for plagiarism"] | ||
description = ["Checks downloaded submissions for plagiarism."] | ||
) | ||
class PlagiarismCommand @Inject constructor( | ||
private val plagiarismChecker: PlagiarismChecker | ||
private val plagiarismChecker: PlagiarismChecker, | ||
private val configHandler: ConfigHandler | ||
) : BaseCommand() { | ||
|
||
override fun execute() { | ||
val submissionsPath = promptTextInput("Enter submissions location (leave empty for current directory):") | ||
val submissionsDirectory = File(submissionsPath) | ||
val baseDir = configHandler.getBaseDir() | ||
val exerciseSubDir = configHandler.getExerciseSubDir() | ||
val submissionsDir = configHandler.getSubmissionsSubDir() | ||
// Target is exercise dir not submissions dir so it's easier to find the folder | ||
val targetDirectory = File(baseDir, exerciseSubDir) | ||
val submissionsDirectory = Path.of(baseDir, exerciseSubDir, submissionsDir).toFile() | ||
|
||
// Make sure the submissions directory exists | ||
if (!submissionsDirectory.isDirectory) { | ||
exitWithError("Submissions directory $submissionsPath does not point to a valid directory.") | ||
exitWithError("Submissions directory '${submissionsDirectory.absolutePath}' does not point to a valid directory.") | ||
} | ||
|
||
// Check the results for plagiarism | ||
plagiarismChecker.generatePlagiarismReport(submissionsDirectory) | ||
plagiarismChecker.generatePlagiarismReport(submissionsDirectory, targetDirectory) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.