<commit_before>import React, { useState } from "react";
import moment from "moment";
import useSortableData from "../hooks/useSortableData";
import { presenceRepository } from "../services/ApplicationContext";
import DatePicker from "../components/DatePicker";

/**
 *
 * @param {*} props
 */
function PresenceByDayReportPage() {
    const [startDate, setStartDate] = useState(new Date());

    const [endDate, setEndDate] = useState(new Date());

    const [presenceList, setPresenceList] = useState([]);

    const { items, requestSort } = useSortableData(presenceList);

    const handleSearch = async () => {
        presenceRepository
            .findPresencesByInterval({
                startDate: startDate,
                endDate: endDate,
            })
            .then((response) => {
                let groupedResponse = response.docs || [];
                let counts = groupedResponse.reduce(
                    (accumulator, currentValue) => {
                        let dia = moment(currentValue.dateTime).format(
                            "DD/MM/YYYY"
                        );

                        if (!accumulator.hasOwnProperty(dia)) {
                            accumulator[dia] = {
                                kumite: 0,
                                firstTime: 0,
                                miKumite: 0,
                                dayAsDate: moment(
                                    currentValue.dateTime
                                ).startOf("day"),
                            };
                        }

                        if (currentValue.firstTime) {
                            accumulator[dia].firstTime++;
                        } else if (currentValue.person.isMiKumite) {<commit_msg>Update PresenceByDayReportPage.jsx<commit_after>import React, { useState } from "react";
import moment from "moment";
import useSortableData from "../hooks/useSortableData";
import { presenceRepository } from "../services/ApplicationContext";
import DatePicker from "../components/DatePicker";

/**
 *
 * @param {*} props
 */
function PresenceByDayReportPage() {
    const [startDate, setStartDate] = useState(new Date());

    const [endDate, setEndDate] = useState(new Date());

    const [presenceList, setPresenceList] = useState([]);

    const { items, requestSort } = useSortableData(presenceList);

    const handleSearch = async () => {
        presenceRepository
            .findPresencesByInterval({
                startDate: startDate,
                endDate: endDate,
            })
            .then((response) => {
                let groupedResponse = response.docs || [];
                let counts = groupedResponse.reduce(
                    (accumulator, currentValue) => {
                        let dia = moment(currentValue.dateTime).format(
                            "DD/MM/YYYY"
                        );

                        if (!accumulator.hasOwnProperty(dia)) {
                            accumulator[dia] = {
                                kumite: 0,
                                firstTime: 0,
                                miKumite: 0,
                                dayAsDate: moment(
                                    currentValue.dateTime
                                ).startOf("day"),
                            };
                        }

                        if (currentValue.isFirstTime) {
                            accumulator[dia].firstTime++;
                        } else if (currentValue.person.isMiKumite) {
{'fraction_non_alphanumeric': 0.10121229207781224, 'fraction_numerical': 0.0016915703411333521, 'mean_word_length': 1.3265573770491803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '806475', 'n_tokens_mistral': 865, 'n_tokens_neox': 810, 'n_words': 169}