<commit_before>import React, { Component } from 'react';
import { callApi } from "../../util/apiConnection.js";

class ThesisList extends Component {
    constructor(props) {
        super(props);
        this.state = {
            theses: [],
            filteredTheses: [],
            searchTerm: ""
        }
    }

    componentDidMount() {
        document.title = "Thesis List Page";
        callApi("/theses").then((resp) => {
            var theses = resp.data.map((thesis) => thesis);
            this.setState(
                {
                    theses: theses,
                    filteredTheses: theses
                }
            );
        }).catch((error) => console.error(error));
    }

    handleFilteringTheses = (e) => {
        var value = e.target.value.toLowerCase();
        //if searchTerm is empty set filteredTheses = theses, else filter theses based on searchTerm
        var filtered = (value === "") ? this.state.theses : this.state.theses.filter((thesis) =>
            (thesis.authorLastname.toLowerCase().includes(value) || thesis.authorFirstname.toLowerCase().includes(value) ||  thesis.title.toLowerCase().includes(value) || thesis.grade.toString() === value)
        );
        this.setState(<commit_msg>fixed bug when thesis renamed to thesisTitle<commit_after>import React, { Component } from 'react';
import { callApi } from "../../util/apiConnection.js";

class ThesisList extends Component {
    constructor(props) {
        super(props);
        this.state = {
            theses: [],
            filteredTheses: [],
            searchTerm: ""
        }
    }

    componentDidMount() {
        document.title = "Thesis List Page";
        callApi("/theses").then((resp) => {
            var theses = resp.data.map((thesis) => thesis);
            this.setState(
                {
                    theses: theses,
                    filteredTheses: theses
                }
            );
        }).catch((error) => console.error(error));
    }

    handleFilteringTheses = (e) => {
        var value = e.target.value.toLowerCase();
        //if searchTerm is empty set filteredTheses = theses, else filter theses based on searchTerm
        var filtered = (value === "") ? this.state.theses : this.state.theses.filter((thesis) =>
            (thesis.authorLastname.toLowerCase().includes(value) || thesis.authorFirstname.toLowerCase().includes(value) ||  thesis.thesisTitle.toLowerCase().includes(value) || thesis.grade.toString() === value)
        );
        this.setState(
{'fraction_non_alphanumeric': 0.1383946223803875, 'fraction_numerical': 0.0, 'mean_word_length': 2.051869722557298, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '1063227', 'n_tokens_mistral': 678, 'n_tokens_neox': 686, 'n_words': 135}