All in GraphQL #34
@ -32,7 +32,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<select name="watching_status" id="watching_status">
|
<select name="watching_status" id="watching_status">
|
||||||
<?php foreach($statuses as $status_key => $status_title): ?>
|
<?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>
|
value="<?= $status_key ?>"><?= $status_title ?></option>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</select>
|
</select>
|
||||||
|
@ -143,16 +143,27 @@ final class ListItem extends AbstractListItem {
|
|||||||
*/
|
*/
|
||||||
public function update(string $id, FormItemData $data): Request
|
public function update(string $id, FormItemData $data): Request
|
||||||
{
|
{
|
||||||
return $this->requestBuilder->mutateRequest('UpdateLibraryItem', [
|
// Data to always send
|
||||||
|
$updateData = [
|
||||||
'id' => $id,
|
'id' => $id,
|
||||||
'notes' => $data['notes'],
|
'notes' => $data['notes'],
|
||||||
'private' => (bool)$data['private'],
|
'private' => (bool)$data['private'],
|
||||||
'progress' => (int)$data['progress'],
|
|
||||||
'ratingTwenty' => (int)$data['ratingTwenty'],
|
|
||||||
'reconsumeCount' => (int)$data['reconsumeCount'],
|
'reconsumeCount' => (int)$data['reconsumeCount'],
|
||||||
'reconsuming' => (bool)$data['reconsuming'],
|
'reconsuming' => (bool)$data['reconsuming'],
|
||||||
'status' => strtoupper($data['status']),
|
'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