Fix updating anime status when certain fields are empty
This commit is contained in:
parent
5bcc046a12
commit
1fbf0283ba
@ -32,7 +32,7 @@
|
||||
<td>
|
||||
<select name="watching_status" id="watching_status">
|
||||
<?php foreach($statuses as $status_key => $status_title): ?>
|
||||
<option <?php if($item['watching_status'] === $status_key): ?>selected="selected"<?php endif ?>
|
||||
<option <?php if(strtolower($item['watching_status']) === $status_key): ?>selected="selected"<?php endif ?>
|
||||
value="<?= $status_key ?>"><?= $status_title ?></option>
|
||||
<?php endforeach ?>
|
||||
</select>
|
||||
|
@ -143,16 +143,27 @@ final class ListItem extends AbstractListItem {
|
||||
*/
|
||||
public function update(string $id, FormItemData $data): Request
|
||||
{
|
||||
return $this->requestBuilder->mutateRequest('UpdateLibraryItem', [
|
||||
// Data to always send
|
||||
$updateData = [
|
||||
'id' => $id,
|
||||
'notes' => $data['notes'],
|
||||
'private' => (bool)$data['private'],
|
||||
'progress' => (int)$data['progress'],
|
||||
'ratingTwenty' => (int)$data['ratingTwenty'],
|
||||
'reconsumeCount' => (int)$data['reconsumeCount'],
|
||||
'reconsuming' => (bool)$data['reconsuming'],
|
||||
'status' => strtoupper($data['status']),
|
||||
]);
|
||||
];
|
||||
|
||||
// Only send these variables if they have a value
|
||||
if ($data['progress'] !== NULL)
|
||||
{
|
||||
$updateData['progress'] = (int)$data['progress'];
|
||||
}
|
||||
if ($data['ratingTwenty'] !== NULL)
|
||||
{
|
||||
$updateData['ratingTwenty'] = (int)$data['ratingTwenty'];
|
||||
}
|
||||
|
||||
return $this->requestBuilder->mutateRequest('UpdateLibraryItem', $updateData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user