Skip to content

Commit

Permalink
MDL-80231 core_ltix: updating references from ltiservice to ltixservice
Browse files Browse the repository at this point in the history
  • Loading branch information
agwells authored and snake committed May 21, 2024
1 parent ca9c78a commit c25501e
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private function process_put_request($body, $olditem, $typeid) {
throw new \Exception(null, 400);
}
$item = \grade_item::fetch(array('id' => $olditem->id, 'courseid' => $olditem->courseid));
$gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($olditem->id);
$gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($olditem->id);
$updategradeitem = false;
$rescalegrades = false;
$oldgrademax = grade_floatval($item->grademax);
Expand Down Expand Up @@ -297,7 +297,7 @@ private function process_delete_request($item) {
global $DB;

$gradeitem = \grade_item::fetch(array('id' => $item->id));
if (($gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($item->id)) == false) {
if (($gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($item->id)) == false) {
throw new \Exception(null, 403);
}
if (!$gradeitem->delete('mod/ltixservice_gradebookservices')) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function execute($response) {
if ($item === false) {
throw new \Exception('Line item does not exist', 404);
}
$gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($itemid);
$gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($itemid);
$ltilinkid = null;
if (isset($item->iteminstance)) {
$ltilinkid = $item->iteminstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function execute($response) {
if ($item === false) {
throw new \Exception('Line item does not exist', 404);
}
$gbs = gradebookservices::find_ltiservice_gradebookservice_for_lineitem($itemid);
$gbs = gradebookservices::find_ltixservice_gradebookservice_for_lineitem($itemid);
$ltilinkid = null;
if (isset($item->iteminstance)) {
$ltilinkid = $item->iteminstance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function get_lineitems($courseid, $resourceid, $ltilinkid, $tag, $limitfr
$lineitemsandtotalcount = array();
if ($lineitems) {
foreach ($lineitems as $lineitem) {
$gbs = $this->find_ltiservice_gradebookservice_for_lineitem($lineitem->id);
$gbs = $this->find_ltixservice_gradebookservice_for_lineitem($lineitem->id);
if ($gbs && (!isset($tag) || (isset($tag) && $gbs->tag == $tag))
&& (!isset($ltilinkid) || (isset($ltilinkid) && $gbs->ltilinkid == $ltilinkid))
&& (!isset($resourceid) || (isset($resourceid) && $gbs->resourceid == $resourceid))) {
Expand Down Expand Up @@ -390,7 +390,7 @@ public function get_lineitem($courseid, $itemid, $typeid) {
require_once($CFG->libdir . '/gradelib.php');
$lineitem = \grade_item::fetch(array('id' => $itemid));
if ($lineitem) {
$gbs = $this->find_ltiservice_gradebookservice_for_lineitem($itemid);
$gbs = $this->find_ltixservice_gradebookservice_for_lineitem($itemid);
if (!$gbs) {
// We will need to check if the activity related belongs to our tool proxy.
$ltiactivity = $DB->get_record('lti', array('id' => $lineitem->iteminstance));
Expand Down Expand Up @@ -571,7 +571,7 @@ public static function item_for_json($item, $endpoint, $typeid) {
$lineitem->id = "{$endpoint}/{$item->id}/lineitem" . $typeidstring;
$lineitem->label = $item->itemname;
$lineitem->scoreMaximum = floatval($item->grademax);
$gbs = self::find_ltiservice_gradebookservice_for_lineitem($item->id);
$gbs = self::find_ltixservice_gradebookservice_for_lineitem($item->id);
if ($gbs) {
$lineitem->resourceId = (!empty($gbs->resourceid)) ? $gbs->resourceid : '';
$lineitem->tag = (!empty($gbs->tag)) ? $gbs->tag : '';
Expand Down Expand Up @@ -734,7 +734,7 @@ public static function update_coupled_gradebookservices(object $ltiinstance,
$resourceid = (isset($resourceid) && empty(trim($resourceid))) ? null : $resourceid;
$subreviewurlstr = $subreviewurl ? $subreviewurl->out(false) : null;
$tag = (isset($tag) && empty(trim($tag))) ? null : $tag;
$gbs = self::find_ltiservice_gradebookservice_for_lineitem($gradeitem->id);
$gbs = self::find_ltixservice_gradebookservice_for_lineitem($gradeitem->id);
if ($gbs) {
$gbs->resourceid = $resourceid;
$gbs->tag = $tag;
Expand Down Expand Up @@ -792,7 +792,7 @@ public function set_instance_form_values(object $defaultvalues): void {
$defaultvalues->subreviewurl = '';
$defaultvalues->subreviewparams = '';
if (is_object($defaultvalues) && $defaultvalues->instance) {
$gbs = self::find_ltiservice_gradebookservice_for_lti($defaultvalues->instance);
$gbs = self::find_ltixservice_gradebookservice_for_lti($defaultvalues->instance);
if ($gbs) {
$defaultvalues->lineitemresourceid = $gbs->resourceid;
$defaultvalues->lineitemtag = $gbs->tag;
Expand All @@ -810,7 +810,7 @@ public function set_instance_form_values(object $defaultvalues): void {
* This method will clean these orphans. It will happens based on a task
* because it is not urgent and we don't want to slow the service
*/
public static function delete_orphans_ltiservice_gradebookservices_rows() {
public static function delete_orphan_ltixservice_gradebookservices_rows() {
global $DB;

$sql = "DELETE
Expand Down Expand Up @@ -853,13 +853,13 @@ public static function is_user_gradable_in_course($courseid, $userid) {
* @param string $instanceid The LTI module instance id
* @return object gradebookservice for this line item
*/
public static function find_ltiservice_gradebookservice_for_lti($instanceid) {
public static function find_ltixservice_gradebookservice_for_lti($instanceid) {
global $DB;

if ($instanceid) {
$gradeitem = $DB->get_record('grade_items', array('itemmodule' => 'lti', 'iteminstance' => $instanceid));
if ($gradeitem) {
return self::find_ltiservice_gradebookservice_for_lineitem($gradeitem->id);
return self::find_ltixservice_gradebookservice_for_lineitem($gradeitem->id);
}
}
}
Expand All @@ -870,7 +870,7 @@ public static function find_ltiservice_gradebookservice_for_lti($instanceid) {
* @param string $lineitemid The lineitem (gradeitem) id
* @return object gradebookservice if it exists
*/
public static function find_ltiservice_gradebookservice_for_lineitem($lineitemid) {
public static function find_ltixservice_gradebookservice_for_lineitem($lineitemid) {
global $DB;
if ($lineitemid) {
return $DB->get_record('ltixservice_gradebookservices',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function get_name() {
* Run forum cron.
*/
public function execute() {
gradebookservices::delete_orphans_ltiservice_gradebookservices_rows();
gradebookservices::delete_orphan_ltixservice_gradebookservices_rows();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function test_lti_add_coupled_lineitem() {

$this->assertNotNull($ltiinstance);

$gbs = gradebookservices::find_ltiservice_gradebookservice_for_lti($ltiinstance->id);
$gbs = gradebookservices::find_ltixservice_gradebookservice_for_lti($ltiinstance->id);

$this->assertNotNull($gbs);
$this->assertEquals($resourceid, $gbs->resourceid);
Expand Down Expand Up @@ -86,7 +86,7 @@ public function test_lti_add_coupled_lineitem_default_subreview() {

$this->assertNotNull($ltiinstance);

$gbs = gradebookservices::find_ltiservice_gradebookservice_for_lti($ltiinstance->id);
$gbs = gradebookservices::find_ltixservice_gradebookservice_for_lti($ltiinstance->id);

$this->assertNotNull($gbs);
$this->assertEquals('DEFAULT', $gbs->subreviewurl);
Expand Down Expand Up @@ -114,7 +114,7 @@ public function test_lti_add_standalone_lineitem() {
}

/**
* @covers ::find_ltiservice_gradebookservice_for_lti
* @covers ::find_ltixservice_gradebookservice_for_lti
*
* Test line item URL is populated for coupled line item only
* if there is not another line item bound to the lti instance,
Expand Down
2 changes: 1 addition & 1 deletion mod/lti/classes/local/ltiservice/service_base.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function get_id() {
*/
public function get_component_id() {

return 'ltiservice_' . $this->id;
return 'ltixservice_' . $this->id;

}

Expand Down

0 comments on commit c25501e

Please sign in to comment.