Skip to content

Commit

Permalink
fixed issue with regen making new logs
Browse files Browse the repository at this point in the history
  • Loading branch information
barncow committed Apr 17, 2011
1 parent 3b16681 commit e61c0dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/logparser/LogParser.class.php
Expand Up @@ -196,7 +196,12 @@ public function parseLogFile($filename, $logSubmitterId, $logName = null, $logMa
$ret = $this->parseLog($file);
} catch(TournamentModeNotFoundException $e) {
//if no tournament mode was found, re-run entire log file as one round.

//clearing state - need to keep log obj
$log = $this->log;
$this->clearValues();
$this->log = $log;

return $this->parseLog($file, true);
}
$tlp->addTime();
Expand All @@ -220,7 +225,12 @@ public function parseLogFromDB($logid) {
$logid = $this->parseLog($file);
} catch(TournamentModeNotFoundException $e) {
//if no tournament mode was found, re-run entire log file as one round.

//clearing state - need to keep log obj
$log = $this->log;
$this->clearValues();
$this->log = $log;

$logid = $this->parseLog($file, true);
}

Expand Down
3 changes: 2 additions & 1 deletion test/phpunit/unit/LogParserTest.php
Expand Up @@ -27,9 +27,10 @@ public function testIgnoreCorruptExceptionOnLastLine() {
public function testParseFromDB() {
$logid = $this->logParser->parseLogFile($this->LFIXDIR."mini.log", 1);
$this->logParser = new LogParser();
$logid = $this->logParser->parseLogFromDB($logid);
$logidnew = $this->logParser->parseLogFromDB($logid);
$log = Doctrine::getTable('Log')->getLogByIdAsArray($logid);

$this->assertEquals(9, count($log['Stats']), "number of players, should exclude console and specs");
$this->assertEquals($logid, $logidnew, 'testing that log id does not change');
}
}

0 comments on commit e61c0dc

Please sign in to comment.