当前位置: 首页>>代码示例>>PHP>>正文


PHP question_attempt_step::get_fraction方法代码示例

本文整理汇总了PHP中question_attempt_step::get_fraction方法的典型用法代码示例。如果您正苦于以下问题:PHP question_attempt_step::get_fraction方法的具体用法?PHP question_attempt_step::get_fraction怎么用?PHP question_attempt_step::get_fraction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在question_attempt_step的用法示例。


在下文中一共展示了question_attempt_step::get_fraction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: make_step_record

 /**
  * Helper method used by insert_question_attempt_step and update_question_attempt_step
  * @param question_attempt_step $step the step to store.
  * @param int $questionattemptid the question attept id this step belongs to.
  * @param int $seq the sequence number of this stop.
  * @return stdClass data to insert into the database.
  */
 protected function make_step_record(question_attempt_step $step, $questionattemptid, $seq)
 {
     $record = new stdClass();
     $record->questionattemptid = $questionattemptid;
     $record->sequencenumber = $seq;
     $record->state = (string) $step->get_state();
     $record->fraction = $step->get_fraction();
     $record->timecreated = $step->get_timecreated();
     $record->userid = $step->get_user_id();
     return $record;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:18,代码来源:datalib.php

示例2: insert_question_attempt_step

 /**
  * Store a {@link question_attempt_step} in the database.
  * @param question_attempt_step $qa the step to store.
  * @param int $questionattemptid the question attept id this step belongs to.
  * @param int $seq the sequence number of this stop.
  * @param object $context the context of the owning question_usage_by_activity.
  */
 public function insert_question_attempt_step(question_attempt_step $step, $questionattemptid, $seq, $context)
 {
     $record = new stdClass();
     $record->questionattemptid = $questionattemptid;
     $record->sequencenumber = $seq;
     $record->state = '' . $step->get_state();
     $record->fraction = $step->get_fraction();
     $record->timecreated = $step->get_timecreated();
     $record->userid = $step->get_user_id();
     $record->id = $this->db->insert_record('question_attempt_steps', $record);
     foreach ($step->get_all_data() as $name => $value) {
         if ($value instanceof question_file_saver) {
             $value->save_files($record->id, $context);
         }
         $data = new stdClass();
         $data->attemptstepid = $record->id;
         $data->name = $name;
         $data->value = $value;
         $this->db->insert_record('question_attempt_step_data', $data, false);
     }
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:28,代码来源:datalib.php

示例3: test_get_set_fraction

 public function test_get_set_fraction()
 {
     $step = new question_attempt_step();
     $step->set_fraction(0.5);
     $this->assertEquals(0.5, $step->get_fraction());
 }
开发者ID:jackdaniels79,项目名称:moodle,代码行数:6,代码来源:questionattemptstep_test.php

示例4: adaptive_mark_details_from_step

    /**
     * Actually populate the qbehaviour_adaptive_mark_details object.
     * @param question_attempt_step $gradedstep the step that holds the relevant mark details.
     * @param question_state $state the state corresponding to $gradedstep.
     * @param unknown_type $maxmark the maximum mark for this question_attempt.
     * @param unknown_type $penalty the penalty for this question, as a fraction.
     */
    protected function adaptive_mark_details_from_step(question_attempt_step $gradedstep,
            question_state $state, $maxmark, $penalty) {

        $details = new qbehaviour_adaptive_mark_details($state);
        $details->maxmark    = $maxmark;
        $details->actualmark = $gradedstep->get_fraction() * $details->maxmark;
        $details->rawmark    = $gradedstep->get_behaviour_var('_rawfraction') * $details->maxmark;

        $details->currentpenalty = $penalty * $details->maxmark;
        $details->totalpenalty   = $details->currentpenalty * $this->qa->get_last_behaviour_var('_try', 0);

        $details->improvable = $this->is_state_improvable($gradedstep->get_state());

        return $details;
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:22,代码来源:behaviour.php


注:本文中的question_attempt_step::get_fraction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。