Skip to content

Instantly share code, notes, and snippets.

@daviddahl
Last active May 9, 2016 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daviddahl/4529820c36bc98cf1227cdc425ebe1f1 to your computer and use it in GitHub Desktop.
Save daviddahl/4529820c36bc98cf1227cdc425ebe1f1 to your computer and use it in GitHub Desktop.
sample calc
case
when {{action}} like 'T_%'
then 'Processing...' -- <-- 1st test
when {{listing_location_id}} <> '{{profile.default_participant.location.id}}' -- <-- 2nd test
then 'N/A'
when {{pre_delivery_verify}} = 'Confirm' and {{action}} <> 'Received' <-- 3rd test
then 'Assured'
when {{actor}} = 'Seller' <-- 4th test
then
case
when {{action}} in ('List','Modify','Reject','Cancel')
then 'For Sale'
when {{action}} in ('Retract','Remove')
then 'Removed'
when {{action}} in ('Counter')
then 'Counter-offer Sent'
when {{action}} in ('Confirm','Accept')
then 'Sold'
else 'Unknown Seller action'
end
when {{actor}} = 'Buyer'
then
case
when {{action}} in ('Accept')
then 'Needs Confirmation'
when {{action}} in ('Counter')
then 'Counter-offer Received'
when {{action}} in ('Confirm')
then 'Sold'
when {{action}} in ('Cancel')
then 'For Sale'
when {{action}} in ('Received')
then 'Delivered'
else 'Unknown Buyer action'
end
else 'Unknown actor'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment