mirror of
https://github.com/google/nomulus.git
synced 2025-05-17 17:59:41 +02:00
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:
parent
5c7a20797e
commit
7487639e62
4 changed files with 33 additions and 3 deletions
|
@ -113,6 +113,7 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
|
|||
.put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime))
|
||||
.put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime))
|
||||
.put("CLIENT_ID", "clientId")
|
||||
.put("OTHER_CLIENT_ID", "otherClientId")
|
||||
.put("TRANSFER_SUCCESS_FIELD", "TRANSFER_GAINING_SUCCESSFUL")
|
||||
.put("TRANSFER_NACKED_FIELD", "TRANSFER_GAINING_NACKED")
|
||||
.put("DEFAULT_FIELD", "field")
|
||||
|
@ -127,7 +128,9 @@ public final class TransactionsReportingQueryBuilder implements QueryBuilder {
|
|||
.put("HISTORYENTRY_TABLE", "HistoryEntry")
|
||||
.put("EARLIEST_REPORT_TIME", timestampFormatter.print(earliestReportTime))
|
||||
.put("LATEST_REPORT_TIME", timestampFormatter.print(latestReportTime))
|
||||
// Roles are reversed for losing queries
|
||||
.put("CLIENT_ID", "otherClientId")
|
||||
.put("OTHER_CLIENT_ID", "clientId")
|
||||
.put("TRANSFER_SUCCESS_FIELD", "TRANSFER_LOSING_SUCCESSFUL")
|
||||
.put("TRANSFER_NACKED_FIELD", "TRANSFER_LOSING_NACKED")
|
||||
.put("DEFAULT_FIELD", "NULL")
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue