my code-to-verb logic was ab0rken; fixed
This commit is contained in:
parent
f4ff375dbd
commit
47cd5f311c
@ -161,6 +161,8 @@ class RSVP extends Managed_DataObject
|
|||||||
$rsvp->event_id = $event->id;
|
$rsvp->event_id = $event->id;
|
||||||
$rsvp->response = self::codeFor($verb);
|
$rsvp->response = self::codeFor($verb);
|
||||||
|
|
||||||
|
common_debug("Got value {$rsvp->response} for verb {$verb}");
|
||||||
|
|
||||||
if (array_key_exists('created', $options)) {
|
if (array_key_exists('created', $options)) {
|
||||||
$rsvp->created = $options['created'];
|
$rsvp->created = $options['created'];
|
||||||
} else {
|
} else {
|
||||||
@ -209,16 +211,36 @@ class RSVP extends Managed_DataObject
|
|||||||
|
|
||||||
function codeFor($verb)
|
function codeFor($verb)
|
||||||
{
|
{
|
||||||
return ($verb == RSVP::POSITIVE) ? 'Y' :
|
switch ($verb) {
|
||||||
($verb == RSVP::NEGATIVE) ? 'N' :
|
case RSVP::POSITIVE:
|
||||||
($verb == RSVP::POSSIBLE) ? '?' : null;
|
return 'Y';
|
||||||
|
break;
|
||||||
|
case RSVP::NEGATIVE:
|
||||||
|
return 'N';
|
||||||
|
break;
|
||||||
|
case RSVP::POSSIBLE:
|
||||||
|
return '?';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown verb {$verb}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static function verbFor($code)
|
static function verbFor($code)
|
||||||
{
|
{
|
||||||
return ($code == 'Y') ? RSVP::POSITIVE :
|
switch ($code) {
|
||||||
($code == 'N') ? RSVP::NEGATIVE :
|
case 'Y':
|
||||||
($code == '?') ? RSVP::POSSIBLE : null;
|
return RSVP::POSITIVE;
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
return RSVP::NEGATIVE;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
return RSVP::POSSIBLE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Exception("Unknown code {$code}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNotice()
|
function getNotice()
|
||||||
|
Loading…
Reference in New Issue
Block a user