<commit_before><?php

/*
 * Grader API functions 
 */

// Load required files
require_once('dptcms/database.php');

// Database class for connection handling
class GraderAPI {
    /*
     * Get a page from currently stored projecttypes. 
     * @start: the item start with
     * @count: the number of items on the page 
     */
    public static function getProjects($start, $count) {
        /* Return the requested pages */
        return ClassDAO::getAllProjects($start, $count);
    }

    public static function getProjectByCourseId($courseid, $start, $count) {
        return ClassDAO::getProjectsByCourseId($courseid, $start, $count);
    }
    
    public static function getProjectCount() {
        /* Return the number of projecttypes currently in the database */
        return ClassDAO::getAllProjectCount();
    }

    public static function getProjectCountByCourseId($courseid) {
        return ClassDAO::getProjectCountByCourseId($courseid);
    }

    public static function getProjectById($id) {
        return ClassDAO::getProjectById($id);
    }

    public static function getAllDataFromProject($id) {
        return ClassDAO::getAllDataFromProject($id);
    }

    public static function getStudentListsFromUser($id)
    {
        return ClassDAO::getStudentListsFromUser($id);
    }
    public static function getLastDropdownFromUser($id) {
        return ClassDAO::getLastDropdownFromUser($id);
    }

    public static function getStudentListsFromProject($id) {
        return ClassDAO::getStudentListsFromProject($id);
    }
    public static function getDocumentsFromProject($id) {
        return ClassDAO::getDocumentsFromProject($id);
    }
    public static function getCoupledListsFromProject($id) {
        return ClassDAO::getCoupledListsFromProject($id);
    }
    public static function getProjectRules($id)
    {
        return ClassDAO::getProjectRules($id);
    }

    public static function removeProjectRule($id)
    {
        return ClassDAO::removeProjectRule($id);
    }

    public static function getScoresForStudentByUser($projectid,$studentid,$userid)
    {
        return ClassDAO::getScoresForStudentByUser($projectid,$studentid,$userid);
    }

    public static function removeUser($userid)
    {
        return UserDAO::removeUser($userid);
    }

    public static function gradeProjectForStudent($projectid, $userid)
    {
        return GradingEngine::gradeProjectForStudent($projectid,$userid);
    }

    /*
     * Delete a projecttype from the database
     */
    public static function deleteProject($id) {
        if (ClassDAO::deleteProject($id) === true) {
            return true;
        } else {
            return false;
        }
    }

    public static function uncoupleProjectStudentlist($projectid, $studentlistid) {
        if (ClassDAO::uncoupleProjectStudentlist($projectid, $studentlistid) === true) {
            return true;
        } else {
            return false;<commit_msg>grading engine<commit_after><?php

/*
 * Grader API functions 
 */

// Load required files
require_once('dptcms/database.php');

// Database class for connection handling
class GraderAPI {
    /*
     * Get a page from currently stored projecttypes. 
     * @start: the item start with
     * @count: the number of items on the page 
     */
    public static function getProjects($start, $count) {
        /* Return the requested pages */
        return ClassDAO::getAllProjects($start, $count);
    }

    public static function getProjectByCourseId($courseid, $start, $count) {
        return ClassDAO::getProjectsByCourseId($courseid, $start, $count);
    }
    
    public static function getProjectCount() {
        /* Return the number of projecttypes currently in the database */
        return ClassDAO::getAllProjectCount();
    }

    public static function getProjectCountByCourseId($courseid) {
        return ClassDAO::getProjectCountByCourseId($courseid);
    }

    public static function getProjectById($id) {
        return ClassDAO::getProjectById($id);
    }

    public static function getAllDataFromProject($id) {
        return ClassDAO::getAllDataFromProject($id);
    }

    public static function getStudentListsFromUser($id)
    {
        return ClassDAO::getStudentListsFromUser($id);
    }
    public static function getLastDropdownFromUser($id) {
        return ClassDAO::getLastDropdownFromUser($id);
    }

    public static function getStudentListsFromProject($id) {
        return ClassDAO::getStudentListsFromProject($id);
    }
    public static function getDocumentsFromProject($id) {
        return ClassDAO::getDocumentsFromProject($id);
    }
    public static function getCoupledListsFromProject($id) {
        return ClassDAO::getCoupledListsFromProject($id);
    }
    public static function getProjectRules($id)
    {
        return ClassDAO::getProjectRules($id);
    }

    public static function removeProjectRule($id)
    {
        return ClassDAO::removeProjectRule($id);
    }

    public static function getScoresForStudentByUser($projectid,$studentid,$userid)
    {
        return ClassDAO::getScoresForStudentByUser($projectid,$studentid,$userid);
    }

    public static function removeUser($userid)
    {
        return UserDAO::removeUser($userid);
    }

    public static function gradeProjectForStudent($projectid, $userid)
    {
        //return GradingEngine::gradeProjectForStudent($projectid,$userid);
        return "Test";
    }

    /*
     * Delete a projecttype from the database
     */
    public static function deleteProject($id) {
        if (ClassDAO::deleteProject($id) === true) {
            return true;
        } else {
            return false;
        }
    }

    public static function uncoupleProjectStudentlist($projectid, $studentlistid) {
        if (ClassDAO::uncoupleProjectStudentlist($projectid, $studentlistid) === true) {
            return true;
        } else {
            return false;
{'fraction_non_alphanumeric': 0.09814814814814815, 'fraction_numerical': 0.0, 'mean_word_length': 3.0859697386519946, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '384115', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1606, 'n_words': 368}