Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Verified Commit 14852059 authored by David Beniamine's avatar David Beniamine
Browse files

WIP : add new calls

+ Delete teamconfig
+ Get number of started reports
parent 15b43120
...@@ -42,6 +42,23 @@ class user extends moodlefetcher ...@@ -42,6 +42,23 @@ class user extends moodlefetcher
return $this->fetch('GET', '/v1/teamconfig/'.$teamconfigId); return $this->fetch('GET', '/v1/teamconfig/'.$teamconfigId);
} }
/**
* @return int
*/
public function getNumStartedReports($teamconfigId)
{
return $this->fetch('GET', '/v1/teamconfig/'.$teamconfigId.'/countStartedReports');
}
/**
* deletes a teamconfig
* @return boolean
*/
public function deleteTeamconfig($teamconfigId)
{
return $this->fetch('POST', '/v1/teamconfig/'.$teamconfigId.'/delete');
}
/** /**
* Give a teacher a tutor access to these LnB missions and classes, if it does not exist yet. * Give a teacher a tutor access to these LnB missions and classes, if it does not exist yet.
* *
......
...@@ -141,13 +141,17 @@ function labnbook_delete_instance($id) ...@@ -141,13 +141,17 @@ function labnbook_delete_instance($id)
{ {
global $DB; global $DB;
$exists = $DB->get_record(LABNBOOK_TABLE, ['id' => $id]); $record = $DB->get_record(LABNBOOK_TABLE, ['id' => $id]);
if (!$exists) { if (!$record) {
return false;
}
$fetcher = new fetch\user();
if (!$fetcher->deleteTeamconfig($record->labnbook_teamconfigid)) {
throw new moodle_exception("Cannot delete teamconfig : some students have started to work.");
return false; return false;
} }
$DB->delete_records(LABNBOOK_TABLE, ['id' => $id]); $DB->delete_records(LABNBOOK_TABLE, ['id' => $id]);
return true;
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment