Jump to content

Crot Anti-plagiarism resubmit and check if date has modified.


AgainstFools

Recommended Posts

Hello guys, i have a problem that i am trying to solve myself for the entire past week. I am not a php programmer and i wish you can help me.

There is a russian project called Crot Anti-Plagiarism, it is a open source moodle plugin. I started to use it and it is a really nice feature. The problem is that there are quite few people that are developing it and new features are coming once a year...

I see a big "hole" in this project (at least for me) : The plugin checks for plagiarism in the file that you submit only once, if a student resubmits the file it doesn't see that and you need to start the plugin's test again for all the files which is time consuming if you have a lot of submitted files to check.

I would like to add a function that will check if a file changed his modified date , if yes - mark for checking, if no - skip the checking.

I already added a similar function that checks if the name has changed, but it seems harder to check it by uploaded time(modified time).

Things i have already done:

I added a new column "assignment_submissions_timemodified" in database.

I added a new function that records the "time modified" of the file in the database.

But i can't add and i cannot make the comparison between the date of the first time the file submitted versus the date of the second time the same file was resubmitted.

Alright no more bullsh**t here is the code: (there are 3 comments that shows what i've changed, starting with  //my job...)

Thanks a lot!

	$apath= $CFG->dataroot."/$assignment->course/moddata/assignment/$asubmission->assignment/$asubmission->userid";
        $timemodified= filemtime($apath);    //my job... it checks the file's modified time.
	$files = scandir($apath, 1);
if (! $unprocessedsubm = get_record("crot_submissions", "submissionid", $asubmission->id, "crot_submission_file_name", $files[0], "assignment_submissions_timemodified", $timemodified))  //my job...now i guess here is the problem ( "assignment_submissions_timemodified", $timemodified)
{
        echo "$timemodified";
        echo "$unprocessedsubm";
		print_r($unprocessedsubm);
		echo "\nsubmission $asubmission->id was not processed yet. start processing now ... \n" ;
		$atime = microtime();
		$atime = explode(" ",$atime);
		$atime = $atime[1] + $atime[0];
		$astarttime = $atime;
		if(!count($files))break;
		//TODO we should verify if filename changed
		//TODO add loop on the documents folder as well as loop for unzipping
		$apath = $apath."/$files[0]";
		// call tokenizer to get plain text and store it in crot_submissions
		$atext = tokenizer ($apath);
		// update the crot_submissions table
		// delete if exists
		delete_records("crot_submissions", "submissionid", $asubmission->id);
		// insert the new record
		$record->submissionid=$asubmission->id;
		$record->updated = time();
		$record->crot_submission_file_name = $files[0];                                   
		$record->assignment_submissions_timemodified = $timemodified;        //this is my job.... it is recording the date as it has to.
		$submid = insert_record("crot_submissions", $record);
		// insert into documents
		$docrecord->crot_submission_id = $submid;

 

Also i have attached the whole file crot_crone.php.

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.