Skip to content

Commit

Permalink
fix(kobo): Fix bookmark progression as int
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusa87 committed Aug 12, 2024
1 parent bcafead commit f558e16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Entity/BookmarkUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public function getPercent(): ?float
return $this->percent;
}

public function getPercentAsInt(): ?int
{
return $this->percent === null ? null : intval($this->percent * 100);
}

public function setPercent(?float $percent): static
{
$this->percent = $percent;
Expand All @@ -70,6 +75,11 @@ public function getSourcePercent(): ?float
return $this->sourcePercent;
}

public function getSourcePercentAsInt(): ?int
{
return $this->sourcePercent === null ? null : intval($this->sourcePercent * 100);
}

public function setSourcePercent(?float $sourcePercent): static
{
$this->sourcePercent = $sourcePercent;
Expand Down
4 changes: 2 additions & 2 deletions src/Kobo/Response/SyncResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ private function createBookmark(?BookmarkUser $bookMark): array
'Value' => $bookMark->getLocationValue(),
'Source' => $bookMark->getLocationSource(),
],
'ProgressPercent' => $bookMark->getPercent(),
'ContentSourceProgressPercent' => $bookMark->getSourcePercent(),
'ProgressPercent' => $bookMark->getPercentAsInt(),
'ContentSourceProgressPercent' => $bookMark->getSourcePercentAsInt(),
];

if (false === $bookMark->hasLocation()) {
Expand Down

0 comments on commit f558e16

Please sign in to comment.