Skip to content

Commit

Permalink
fix setting a scheduling rule for new tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
recursivetree committed Aug 30, 2024
1 parent 0896b6b commit 1ec58e9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Models/CharacterSchedulingRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use Seat\Eveapi\Models\Character\CharacterInfo;
use Seat\Eveapi\Models\RefreshToken;
use Seat\Eveapi\Models\RefreshTokenSchedule;
use Seat\Services\Models\ExtensibleModel;
use stdClass;

Expand Down Expand Up @@ -61,6 +62,12 @@ public function getFilters(): stdClass
public static function updateRefreshTokenSchedule(RefreshToken $token): void
{
$schedule = $token->token_schedule;

if($schedule === null) {
$schedule = new RefreshTokenSchedule();
$schedule->character_id = $token->character_id;
}

$schedule->update_interval = self::getCharacterSchedulingInterval($token->character);
$schedule->save();
}
Expand Down

0 comments on commit 1ec58e9

Please sign in to comment.