<commit_before>import {Response} from "quill-marking-logic"

interface Attempt {
  response: Response
}

function getAnswerState(attempt): boolean {
  return (attempt.response.optimal && attempt.response.author === undefined && attempt.author === undefined)
}

export default getAnswerState;<commit_msg>Fix answer state null error.<commit_after>import {Response} from "quill-marking-logic"

interface Attempt {
  response: Response
}

function getAnswerState(attempt: Attempt|undefined): boolean {
  if (attempt) {
    return (!!attempt.response.optimal && attempt.response.author === undefined)
  }
  return false
}

export default getAnswerState;
{'fraction_non_alphanumeric': 0.11265432098765432, 'fraction_numerical': 0.0, 'mean_word_length': 5.622448979591836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3947340', 'n_tokens_mistral': 192, 'n_tokens_neox': 174, 'n_words': 46}