<commit_before><?php
$evaluation = isset($user['Evaluation']) ? $user['Evaluation'] : null;
$self = isset($self) ? $self : null;
$evaluation = $self_eval ? $self : $evaluation;
$details = Set::combine($evaluation['EvaluationMixevalDetail'], '{n}.question_number', '{n}');
$peerNum = 1;
echo "<input type='hidden' name=data[$user[id]][".$eval."][evaluatee_id] value='$user[id]'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][evaluator_id] value='".User::get('id')."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][event_id] value='".$event['Event']['id']."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][group_event_id] value='".$event['GroupEvent']['id']."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][group_id] value='".$event['Group']['id']."'/>";
foreach ($questions as $ques) {
    if ($ques['MixevalQuestion']['self_eval'] != $self_eval) {
        continue; // skip questions not in this section (eg. self eval, peer eval)
    }
    $type = $ques['MixevalQuestionType']['type'];
    $num = $ques['MixevalQuestion']['question_num'];
    $instruct = $ques['MixevalQuestion']['instructions'];
    $instruct = $instruct ? $html->para('help green', $instruct) : '';
    $required = (!$ques['MixevalQuestion']['required']) ? '' :
        $html->tag('span', '*', array('class' => 'required orangered floatright'));
    $title = $ques['MixevalQuestion']['title'];
    $title = $html->tag('h3', "$peerNum. $title $required", array('class' => 'question-title', 'id' => 'q_'.$user['id'].'_'.$num));
    $class = $ques['MixevalQuestion']['required'] ? 'must' : '';
    $peerNum++;

    if ($type == 'Paragraph') {
        $value = (isset($details[$num])) ? $details[$num]['question_comment'] : '';
        $output = $html->div('MixevalQuestion',
            $title .
            $instruct .
            $form->textarea('EvaluationMixeval.'.$num.'.question_comment',
                array('default' => $value, 'class' => $class,
                    'name' => 'data['.$user['id'].'][EvaluationMixeval]['.$num.'][question_comment]'))
        );
    } else if ($type == 'Sentence') {
        $value = (isset($details[$num])) ? $details[$num]['question_comment'] : '';
        $output = $html->div('MixevalQuestion',
            $title .
            $instruct .
            $form->input($user['id'].'.EvaluationMixeval.'.$num.'.question_comment',
                array('label' => false, 'default' => $value, 'type' => 'text', 'class' => $class,
                    'name' => 'data['.$user['id'].'][EvaluationMixeval]['.$num.'][question_comment]'))
        );
    } else if ($type == 'Likert') {
        $highestMark = $ques['MixevalQuestion']['multiplier'];
        $scale = count($ques['MixevalQuestionDesc']);
        $options = array();
        $descs = array();
        $marks = array();
        $markLabel = "Mark: ";
        $subIf0 = 0;
        if ($zero_mark) {
            $subIf0 = 1;
            $scale -= $subIf0;
        }
        foreach ($ques['MixevalQuestionDesc'] as $desc) {
            $descs[] = $desc['descriptor'];
            $desc['scale_level'] -= $subIf0;
            $mark = $highestMark * ($desc['scale_level'] / $scale);
            $checked = '';
            if (isset($details[$num])) {<commit_msg>Fix mixeval scale was incorrect rendered when upgrade 3.1<commit_after><?php
$evaluation = isset($user['Evaluation']) ? $user['Evaluation'] : null;
$self = isset($self) ? $self : null;
$evaluation = $self_eval ? $self : $evaluation;
$details = Set::combine($evaluation['EvaluationMixevalDetail'], '{n}.question_number', '{n}');
$peerNum = 1;
echo "<input type='hidden' name=data[$user[id]][".$eval."][evaluatee_id] value='$user[id]'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][evaluator_id] value='".User::get('id')."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][event_id] value='".$event['Event']['id']."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][group_event_id] value='".$event['GroupEvent']['id']."'/>";
echo "<input type='hidden' name=data[$user[id]][".$eval."][group_id] value='".$event['Group']['id']."'/>";
foreach ($questions as $ques) {
    if ($ques['MixevalQuestion']['self_eval'] != $self_eval) {
        continue; // skip questions not in this section (eg. self eval, peer eval)
    }
    $type = $ques['MixevalQuestionType']['type'];
    $num = $ques['MixevalQuestion']['question_num'];
    $instruct = $ques['MixevalQuestion']['instructions'];
    $instruct = $instruct ? $html->para('help green', $instruct) : '';
    $required = (!$ques['MixevalQuestion']['required']) ? '' :
        $html->tag('span', '*', array('class' => 'required orangered floatright'));
    $title = $ques['MixevalQuestion']['title'];
    $title = $html->tag('h3', "$peerNum. $title $required", array('class' => 'question-title', 'id' => 'q_'.$user['id'].'_'.$num));
    $class = $ques['MixevalQuestion']['required'] ? 'must' : '';
    $peerNum++;

    if ($type == 'Paragraph') {
        $value = (isset($details[$num])) ? $details[$num]['question_comment'] : '';
        $output = $html->div('MixevalQuestion',
            $title .
            $instruct .
            $form->textarea('EvaluationMixeval.'.$num.'.question_comment',
                array('default' => $value, 'class' => $class,
                    'name' => 'data['.$user['id'].'][EvaluationMixeval]['.$num.'][question_comment]'))
        );
    } else if ($type == 'Sentence') {
        $value = (isset($details[$num])) ? $details[$num]['question_comment'] : '';
        $output = $html->div('MixevalQuestion',
            $title .
            $instruct .
            $form->input($user['id'].'.EvaluationMixeval.'.$num.'.question_comment',
                array('label' => false, 'default' => $value, 'type' => 'text', 'class' => $class,
                    'name' => 'data['.$user['id'].'][EvaluationMixeval]['.$num.'][question_comment]'))
        );
    } else if ($type == 'Likert') {
        $highestMark = $ques['MixevalQuestion']['multiplier'];
        $scale = count($ques['MixevalQuestionDesc']);
        $options = array();
        $descs = array();
        $marks = array();
        $markLabel = __("Mark", true).": ";
        $subIf0 = 0;
        if ($zero_mark) {
            $subIf0 = 1;
            $scale -= $subIf0;
        }
        foreach ($ques['MixevalQuestionDesc'] as $key => $desc) {
            $descs[] = $desc['descriptor'];
            if ($desc['scale_level'] == 0) {
                // upgraded from pre 3.1, scale_levels are set to 0. So use $key as level
                $desc['scale_level'] = $subIf0 ? $key : $key + 1;
            } else {
                $desc['scale_level'] -= $subIf0;
            }
            $mark = $highestMark * ($desc['scale_level'] / $scale);
            $checked = '';
            if (isset($details[$num])) {
{'fraction_non_alphanumeric': 0.23905772866075323, 'fraction_numerical': 0.003489893849062091, 'mean_word_length': 3.2067278287461773, 'pattern_counts': {'":': 1, '<': 15, '<?xml version=': 0, '>': 50, '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': '5895371', 'n_tokens_mistral': 2174, 'n_tokens_neox': 2139, 'n_words': 381}