首页 > 解决方案 > 需要使用 ims-lti gem 从老师端将分数发送回 LMS

问题描述

嗨,我正在将此 gem 用于基于 ruby​​ 的应用程序,并且我想将分数发送回 LMS,但问题是在我的平台上,老师现在可以为作业评分,我想在老师从 LMS 内部查看应用程序,

@teacher_loogedin.student_1_grade是当老师使用我的 LTI 提供程序工具在 LMS 中登录他/她的帐户时学生的成绩,现在我想将分数发回 LMS 并且 LMS 应该代表学生记录分数student 1,我可以这样做吗?

我已经编写了一个函数来实现这一点,但这里的分数只是参数,如何使用学生特定的参数,student_email这样分数只反映给那个特定的学生。

这是我的功能,但如何实现我想要的目标?

def submitscore
    @tp = IMS::LTI::ToolProvider.new(@@launch_params[:oauth_consumer_key],
    Rails.configuration.lti_settings[@@launch_params[:oauth_consumer_key]],
    @@launch_params)
    # add extension
    @tp.extend IMS::LTI::Extensions::OutcomeData::ToolProvider

    if !@tp.outcome_service?
      @message = "This tool wasn't lunched as an outcome service"
      puts "This tool wasn't lunched as an outcome service"
      render(:launch_error)
    end

    res = @tp.post_extended_replace_result!(score: params[:result]) # here I want to pass a parameter of student email such that the corresponding student can be graded

    if res.success?
      puts "Score Submitted"
    else
      puts "Error during score submission"
    end
    redirect_to @@launch_params[:launch_presentation_return_url]
  end

标签: rubycanvasmoodleltilms

解决方案


推荐阅读