@@ -42,10 +42,13 @@ export async function createRecordButton() {
4242 function singleRecordButton ( i : number , j : number ) {
4343 const button = document . querySelectorAll ( ".record-button:first-of-type" ) [ j ] ;
4444 button . addEventListener ( "click" , async ( ) => {
45+ const recordContainer = document . querySelectorAll ( ".record-container" ) ;
4546 let mutation = "mutation{" ;
4647
4748 // 視聴ステータスが"見てる"以外だった場合、"見てる"に変更
48- mutation = changeStatusToWatching ( mutation ) ;
49+ if ( ! ( ! isAiring && j === recordContainer . length - 1 ) ) {
50+ mutation = changeStatusToWatching ( mutation ) ;
51+ }
4952
5053 mutation += `
5154 createRecord (
@@ -56,7 +59,7 @@ export async function createRecordButton() {
5659 // 最終話まで見ている場合は、ステータスを"見た"に変更
5760 if (
5861 ! isAiring && // アニメが放送終了
59- j === document . querySelectorAll ( ".record-container" ) . length - 1 // 最終話
62+ j === recordContainer . length - 1 // 最終話
6063 ) {
6164 mutation += `
6265 updateStatus(
@@ -81,11 +84,14 @@ export async function createRecordButton() {
8184 function multiRecordButton ( i : number , j : number ) {
8285 const button = document . querySelectorAll ( ".record-button:last-of-type" ) [ j ] ;
8386 button . addEventListener ( "click" , async ( ) => {
87+ const recordContainer = document . querySelectorAll ( ".record-container" ) ;
8488 // その話数までのcreateRecordを作成してマージ
8589 let mutation = "mutation{" ;
8690
8791 // ステータスを"見たい"に変更
88- mutation = changeStatusToWatching ( mutation ) ;
92+ if ( ! ( ! isAiring && j === recordContainer . length - 1 ) ) {
93+ mutation = changeStatusToWatching ( mutation ) ;
94+ }
8995
9096 const count = i - j ;
9197 const recordContainers : NodeListOf < HTMLElement > =
@@ -102,7 +108,7 @@ export async function createRecordButton() {
102108 // 最終話まで見ている場合は、ステータスを"見た"に変更
103109 if (
104110 ! isAiring && // アニメが放送終了
105- j === document . querySelectorAll ( ".record-container" ) . length - 1 // 最終話
111+ j === recordContainer . length - 1 // 最終話
106112 ) {
107113 mutation += `
108114 updateStatus(
0 commit comments