<commit_before><template>

<select v-model="grade">

    <option v-for="n in years"
            v-bind:value="n"
            v-bind:key="'grade' + n">{{ n }}</option>

</select>

</template>

<script>

import degrees from '../data/degrees'
import bus, { events } from './event-bus'

export default {

    props: [
        'defaults',
        'degree'
    ],

    data () {
        return {
            grade: this.defaults,
            degree_id : this.degree
        }
    },

    computed: {
        years () {

            let degree = degrees.filter((degree) => degree.id === this.degree_id)[0]
            let study_year = degree && degree.study_year || 0

            return study_year
        }
    },

    created () {
        bus.$on(events.changeDegree.name, (data) => {
            this.degree_id = data.degree.id
        })
    }
}

</script>
<commit_msg>如果degree id不存在則丟出錯誤<commit_after><template>

<select v-model="grade">

    <option v-for="n in years"
            v-bind:value="n"
            v-bind:key="'grade' + n">{{ n }}</option>

</select>

</template>

<script>

import degrees from '../data/degrees'
import bus, { events } from './event-bus'

export default {

    props: [
        'defaults',
        'degree'
    ],

    data () {
        return {
            grade: this.defaults,
            degree_id : this.degree
        }
    },

    computed: {
        years () {

            let degree = degrees.filter((degree) => degree.id === this.degree_id)[0]
            if (!degree && !degree.study_year) {
                throw new Error('不存在該學位，degree id=' + this.degree_id)
            }

            return degree.study_year
        }
    },

    created () {
        bus.$on(events.changeDegree.name, (data) => {
            this.degree_id = data.degree.id
        })
    }
}

</script>

{'fraction_non_alphanumeric': 0.1551155115511551, 'fraction_numerical': 0.0016501650165016502, 'mean_word_length': 1.6671554252199414, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, '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': '6310931', 'n_tokens_mistral': 599, 'n_tokens_neox': 587, 'n_words': 114}