Skip to content

Commit

Permalink
Fix extension not applied for hidden courses
Browse files Browse the repository at this point in the history
  • Loading branch information
aydevworks committed Jan 21, 2025
1 parent c67c6f2 commit a96e002
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/extension/aws_queue_processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function execute(): void {
}
$this->process_message($data);
$this->save_message_record($message, $this->get_queue_name());
$this->delete_message($message['ReceiptHandle']);
// $this->delete_message($message['ReceiptHandle']);
$processedcount++;
} catch (\Exception $e) {
logger::log($e->getMessage(), null, static::class . ' Processing Error');
Expand Down
4 changes: 2 additions & 2 deletions classes/extension/extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ public function get_mappings_by_userid(int $userid): array {
global $DB;

// Find all enrolled courses for the student.
$courses = enrol_get_users_courses($userid, true);

$courses = enrol_get_users_courses($userid);
mtrace('courses: ' . var_export($courses, true));
// Get courses that are in the current academic year.
$courses = array_filter($courses, function($course) {
return manager::get_manager()->is_current_academic_year_activity($course->id);
Expand Down
1 change: 1 addition & 0 deletions classes/extension/sora_queue_processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ protected function process_message(array $messagebody): void {

// Get all mappings for the student.
$mappings = $sora->get_mappings_by_userid($sora->get_userid());
mtrace('Mappings: ' . var_export($mappings, true));
$sora->process_extension($mappings);
}

Expand Down
4 changes: 3 additions & 1 deletion classes/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,14 @@ public function get_students_from_sits(\stdClass $componentgrade, bool $refresh

$key = implode('_', [cachemanager::CACHE_AREA_STUDENTSPR, $componentgrade->mapcode, $componentgrade->mabseq]);
if ($refresh) {
mtrace('cache clear');
// Clear cache.
cachemanager::purge_cache(cachemanager::CACHE_AREA_STUDENTSPR, $key);
} else {
// Try to get cache first.
$students = cachemanager::get_cache(cachemanager::CACHE_AREA_STUDENTSPR, $key);
if (!empty($students)) {
mtrace('cache hit');
return $students;
}
}
Expand All @@ -662,7 +664,7 @@ public function get_students_from_sits(\stdClass $componentgrade, bool $refresh
DAYSECS * 30
);
}

mtrace('cache miss');
return $result;
}

Expand Down

0 comments on commit a96e002

Please sign in to comment.