Skip to content

Commit

Permalink
Add a working token counter
Browse files Browse the repository at this point in the history
  • Loading branch information
rrusso committed Feb 22, 2024
1 parent db3ab8d commit ce64a72
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion local/d1/classes/d1.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,11 @@ public static function course_grade_postings($postings) {
}

// Merge the returner into the array with the approriate count.
$pgs[$counter] = $returner;
$pgs[$eounter] = $returner;

// Increment the couneter.
$counter++;
$counter2++;
}

// Return the array of postings and statuses.
Expand Down
19 changes: 19 additions & 0 deletions local/d1/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public function run_post_odl() {
// Get a token.
$token = lsupgd1::get_token();

// Instantiate the token counter and set its count to 0;
$tokencounter = 0;

// Get the list of courses to be posted.
$odlcourses = lsupgd1::get_odl_dgps(true);

Expand Down Expand Up @@ -109,6 +112,13 @@ public function run_post_odl() {

// Increment the counter.
$count++;
$tokencounter++;

// Get a new token every 100 rows.
if ($tokencounter % 100 == 0) {
$token = self::get_token();
mtrace("Got new token: $token.");
}

// Set the cs objectId to the PD Grade object.
$odlgrade->csobjectid = $csobjectid;
Expand Down Expand Up @@ -149,6 +159,8 @@ public function run_post_pd() {
// Get a token.
$token = lsupgd1::get_token();

$tokencounter = 0;

// Get the list of courses to be posted.
$pdcourses = lsupgd1::get_pd_dgps(true);

Expand Down Expand Up @@ -176,6 +188,13 @@ public function run_post_pd() {

// Increment the counter.
$count++;
$tokencounter++;

// Get a new token every 100 rows.
if ($tokencounter % 100 == 0) {
$token = self::get_token();
mtrace("Got new token: $token.");
}

// Set the cs objectId to the PD Grade object.
$pdgrade->csobjectid = $csobjectid;
Expand Down

0 comments on commit ce64a72

Please sign in to comment.