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 class Result extends Enum
{ {
const none = 0; const none = '*';
const lost = 1; const lost = '0';
const draw = 6; const draw = '0.5';
const won = 11; const won = '1';
const absent = 2; const absent = '0 FF';
const wonforfait = 12; const wonforfait = '1 FF';
const adjourn = 3; const adjourn = '0 A';
const drawadjourned = 8; const drawadjourned = '0.5 A';
const wonadjourned = 13; const wonadjourned = '1 A';
const bye = 4; const bye = '0 Bye';
const wonbye = 14; const wonbye = '1 Bye';
} }

View File

@ -509,7 +509,43 @@ class Sws extends SwsModel
$offset += $length; $offset += $length;
$length = 1; $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; $offset += $length;
$pairing->setRound($x); $pairing->setRound($x);