LiamM32 / Eurovision_Condorcet

A program to count votes for the Eurovision Song Contest using a redesigned voting system.
1 stars 2 forks source link

`Call to undefined method CondorcetPHP\Condorcet\Election::getPopulations()` #2

Closed LiamM32 closed 1 year ago

LiamM32 commented 1 year ago

Currently, if there are no other errors, running this program results in the following error:

PHP Fatal error:  Uncaught Error: Call to undefined method CondorcetPHP\Condorcet\Election::getPopulations() in /home/liam/src/Eurovision_Condorcet/src/main.php:18
Stack trace:
#0 {main}
  thrown in /home/liam/src/Eurovision_Condorcet/src/main.php on line 18

It is not clear to me why this error happens. @julien-boudry

julien-boudry commented 1 year ago

Try:

$contest = new Contest;
$votesdata->setDataToAnElection($contest);
$contest->getPopulations();

Because if you call setDataToAnElection without argument, create and return a new Election object.

LiamM32 commented 1 year ago

Thank you. This works. In the most recent commit this program doesn't have any errors.