fix: clean up console log

pull/100/head
Pierre-Louis Guhur 1 year ago
parent 058523aa1d
commit 0f2c4992d7

@ -136,13 +136,11 @@ const MeritProfileBar = ({profile, grades}: MeritProfileBarInterface) => {
// find the majority grade
const majorityValue = getMajorityGrade(normalized);
const majorityGrade = gradesByValue[majorityValue];
console.log(majorityGrade, majorityValue, grades, normalized)
const proponentSizes = values
.filter((v) => v > majorityGrade.value)
.map((v) => normalized[v]);
const proponentWidth = proponentSizes.reduce((a, b) => a + b, 0);
console.log(proponentWidth, proponentSizes)
const opponentSizes = values
.filter((v) => v < majorityGrade.value)

@ -1,17 +1,17 @@
import { useState, useEffect, useRef, KeyboardEvent } from 'react';
import { Row, Col, Label, Input, Modal, ModalBody, Form } from 'reactstrap';
import { faPlus, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
import { useTranslation } from 'next-i18next';
import {useState, useEffect, useRef, KeyboardEvent} from 'react';
import {Row, Col, Label, Input, Modal, ModalBody, Form} from 'reactstrap';
import {faPlus, faArrowLeft} from '@fortawesome/free-solid-svg-icons';
import {useTranslation} from 'next-i18next';
import Image from 'next/image';
import { ElectionTypes, useElection } from '@services/ElectionContext';
import {ElectionTypes, useElection} from '@services/ElectionContext';
import Button from '@components/Button';
import { upload } from '@services/imgpush';
import { IMGPUSH_URL } from '@services/constants';
import { AppTypes, useAppContext } from '@services/context';
import {upload} from '@services/imgpush';
import {IMGPUSH_URL} from '@services/constants';
import {AppTypes, useAppContext} from '@services/context';
import defaultAvatar from '../../public/default-avatar.svg';
const CandidateModal = ({ isOpen, position, toggle }) => {
const { t } = useTranslation();
const CandidateModal = ({isOpen, position, toggle}) => {
const {t} = useTranslation();
const [election, dispatch] = useElection();
const candidate = election.candidates[position];
const [state, setState] = useState(candidate);
@ -19,7 +19,7 @@ const CandidateModal = ({ isOpen, position, toggle }) => {
const handleFile = async (event) => {
const payload = await upload(event.target.files[0]);
setState((s) => ({ ...s, image: `${IMGPUSH_URL}/${payload['filename']}` }));
setState((s) => ({...s, image: `${IMGPUSH_URL}/${payload['filename']}`}));
};
const [app, dispatchApp] = useAppContext();
@ -41,7 +41,6 @@ const CandidateModal = ({ isOpen, position, toggle }) => {
useEffect(() => {
// When isOpen got active, we put the focus on the input field
setTimeout(() => {
console.log(inputRef.current);
if (isOpen && inputRef && inputRef.current) {
inputRef.current.focus();
}
@ -98,11 +97,11 @@ const CandidateModal = ({ isOpen, position, toggle }) => {
};
const handleName = (e) => {
setState((s) => ({ ...s, name: e.target.value }));
setState((s) => ({...s, name: e.target.value}));
};
const handleDescription = (e) => {
setState((s) => ({ ...s, description: e.target.value }));
setState((s) => ({...s, description: e.target.value}));
};
return (

@ -1,15 +1,15 @@
import { useState, useEffect, useRef, KeyboardEvent, ChangeEvent } from 'react';
import { Label, Modal, ModalBody, Form } from 'reactstrap';
import { faPlus, faArrowLeft } from '@fortawesome/free-solid-svg-icons';
import { useTranslation } from 'next-i18next';
import { ElectionTypes, useElection } from '@services/ElectionContext';
import {useState, useEffect, useRef, KeyboardEvent, ChangeEvent} from 'react';
import {Label, Modal, ModalBody, Form} from 'reactstrap';
import {faPlus, faArrowLeft} from '@fortawesome/free-solid-svg-icons';
import {useTranslation} from 'next-i18next';
import {ElectionTypes, useElection} from '@services/ElectionContext';
import Button from '@components/Button';
import { checkName } from '@services/ElectionContext';
import { AppTypes, useAppContext } from '@services/context';
import { useRouter } from 'next/router';
import {checkName} from '@services/ElectionContext';
import {AppTypes, useAppContext} from '@services/context';
import {useRouter} from 'next/router';
const TitleModal = ({ isOpen, toggle }) => {
const { t } = useTranslation();
const TitleModal = ({isOpen, toggle}) => {
const {t} = useTranslation();
const router = useRouter();
const [election, dispatch] = useElection();
const [_, dispatchApp] = useAppContext();
@ -25,7 +25,6 @@ const TitleModal = ({ isOpen, toggle }) => {
useEffect(() => {
// When isOpen got active, we put the focus on the input field
setTimeout(() => {
console.log(inputRef.current);
if (isOpen && inputRef && inputRef.current) {
inputRef.current.focus();
}

@ -66,7 +66,6 @@ export async function getServerSideProps({query: {pid, tid}, locale}) {
if (description.randomOrder) {
shuffle(election.candidates);
}
console.log("BALLOT", ballot)
return {
props: {

@ -71,7 +71,6 @@ export async function getServerSideProps({query, locale}) {
const values = grades.map((g) => g.value);
values.forEach((v) => (profile[v] = profile[v] || 0));
const majValue = getMajorityGrade(profile);
console.log(profile, majValue)
return {
...c,
meritProfile: payload.merit_profile[c.id],

@ -14,7 +14,6 @@ export const getMajorityGrade = (profile: MeritProfileInterface): number => {
throw new Error('Merit profile is empty');
}
console.log("INDICES", grades);
const numVotes = Object.values(profile).reduce((a, b) => a + b, 0);
let majorityGrade = grades[0];
let accBefore = 0;

Loading…
Cancel
Save