Move row to a different sheet when box is checked

Hi I'm very new to coding with Google Sheets and Excel. My goal is to move a row when it is checked off.

The original sheet is called "School Assignments" and the sheet I want to move it to is called "Finished". When a box in column H (column 8) is checked the data value of the row becomes "Done". When it is not marked it is "Unfinished".

I want the row to move to the Finished sheet when I mark it as "Done". I also want this to work vice versa where when I uncheck and it becomes "Unfinished" it it goes back to the School Assignments sheet. I have some code but honestly it was done months ago (I'm coming back to this project after a break) and I'm not sure what I was thinking when I wrote it or if it is correct at all. It doesn't work obviously.

  if(sh.getName() == "School Assignments" && e.range.columnStart == 8 && e.value == "Done") {
    let tsh = e.source.getSheetByName("Finished");
    sh.getRange(e.range.rowStart, 1, 1, sh.getLastColumn()).moveTo(tsh.getRange(tsh.getLastRow() + 1, 1));
  } else if(sh.getName() == "Finished" && e.range.columnStart == 8 && e.value == "Unfinished") {
    let tsh = e.source.getSheetByName("School Assignments");
    let trg = tsh.getRange(tsh.getLastRow() + 1, 1);
    sh.getRange(e.range.rowStart, 1, 1, sh.getLastColumn()).moveTo(trg);

I also have an auto-sorting piece earlier in the code which defines some constants.

    const ss = SpreadsheetApp.getActiveSpreadsheet()
    const ws = ss.getSheetByName("School Assignments")
    const range = ws.getRange(2,1,ws.getLastRow()-1,8)

    range.sort({column: 7, ascending: true })

I am totally unsure how to fix this and accomplish what I'm looking to do.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum