Get rid of Pairtwo Values in favor of generic ones

This commit is contained in:
Jeroen De Meerleer 2019-03-04 12:07:43 +01:00
parent 0adad0fd91
commit 6794e44275
2 changed files with 48 additions and 12 deletions

View File

@ -12,15 +12,15 @@ use MyCLabs\Enum\Enum;
class Result extends Enum
{
const none = 0;
const lost = 1;
const draw = 6;
const won = 11;
const absent = 2;
const wonforfait = 12;
const adjourn = 3;
const drawadjourned = 8;
const wonadjourned = 13;
const bye = 4;
const wonbye = 14;
const none = '*';
const lost = '0';
const draw = '0.5';
const won = '1';
const absent = '0 FF';
const wonforfait = '1 FF';
const adjourn = '0 A';
const drawadjourned = '0.5 A';
const wonadjourned = '1 A';
const bye = '0 Bye';
const wonbye = '1 Bye';
}

View File

@ -509,7 +509,43 @@ class Sws extends SwsModel
$offset += $length;
$length = 1;
$pairing->setResult(new Result(self::ReadData('Int', substr($swscontents, $offset, $length))));
Switch(self::ReadData('Int', substr($swscontents, $offset, $length)))
{
case 0:
$result = '*';
break;
case 1:
$result = '0';
break;
case 2:
$result = '0 FF';
break;
case 3:
$result = '0 A';
break;
case 4:
$result = '0 Bye';
break;
case 6:
$result = '0.5';
break;
case 8:
$result = '0.5 A';
break;
case 11:
$result = '1';
break;
case 12:
$result = '1 FF';
break;
case 13:
$result = '1 A';
break;
case 13:
$result = '1 Bye';
break;
}
$pairing->setResult(new Result($result));
$offset += $length;
$pairing->setRound($x);