def _merge_latest_ping()

in etl/glean.py [0:0]


def _merge_latest_ping(pings, ping_name, ping_data):
    """
    Merge data for the latest `ping_name` into `pings` (by history date).
    If `pings` already contains the ping with newer data it is not overwritten.
    """
    if ping_name not in pings:
        pings[ping_name] = ping_data
        return

    latest = pings[ping_name]["history"][-1]["dates"]["last"]
    new = ping_data["history"][-1]["dates"]["last"]
    if new >= latest:
        pings[ping_name] = ping_data