Enhance transfer logic for transaction reporting

Explicit transfer acks/nacks reverse the roles for transaction reporting
tabulation- this adds a quick check to account for this going forward.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=199474444
This commit is contained in:
larryruili 2018-06-06 09:07:21 -07:00 committed by Ben McIlwain
parent 5c7a20797e
commit 7487639e62
4 changed files with 33 additions and 3 deletions

View file

@ -45,7 +45,16 @@ FROM (
SUM(amount) AS metricValue
FROM (
SELECT
entries.%CLIENT_ID% AS clientId,
CASE
-- Explicit transfer acks (approve) and nacks (reject) are done
-- by the opposing registrar. Thus, for these specific actions,
-- we swap the 'otherClientId' with the 'clientId' to properly
-- account for this reversal.
WHEN (entries.type = 'DOMAIN_TRANSFER_APPROVE'
OR entries.type = 'DOMAIN_TRANSFER_REJECT')
THEN entries.%OTHER_CLIENT_ID%
ELSE entries.%CLIENT_ID%
END AS clientId,
entries.domainTransactionRecords.tld[SAFE_OFFSET(index)] AS tld,
entries.domainTransactionRecords.reportingTime[SAFE_OFFSET(index)]
AS reportingTime,