Exemple #1
0
def on_loan_created_statsdb(loan):
    """Adds the loan info to the stats database."""
    key = _get_loan_key(loan)
    t_start = datetime.datetime.utcfromtimestamp(loan['loaned_at'])
    d = {
        "book": loan['book'],
        "identifier": loan['ocaid'],
        "resource_type": loan['resource_type'],
        "t_start": t_start.isoformat(),
        "status": "active",
    }
    d['library'] = "/libraries/internet_archive"
    d['geoip_country'] = None  # we removed geoip
    statsdb.add_entry(key, d)
Exemple #2
0
def on_loan_created_statsdb(loan):
    """Adds the loan info to the stats database.
    """
    key = _get_loan_key(loan)
    t_start = datetime.datetime.utcfromtimestamp(loan['loaned_at'])
    d = {
        "book": loan['book'],
        "resource_type": loan['resource_type'],
        "t_start": t_start.isoformat(),
        "status": "active"
    }
    library = inlibrary.get_library()
    d['library'] = library and library.key
    d['geoip_country'] = geo_ip.get_country(web.ctx.ip)
    statsdb.add_entry(key, d)
Exemple #3
0
def on_loan_created_statsdb(loan):
    """Adds the loan info to the stats database.
    """
    key = _get_loan_key(loan)
    t_start = datetime.datetime.utcfromtimestamp(loan['loaned_at'])
    d = {
        "book": loan['book'],
        "resource_type": loan['resource_type'],
        "t_start": t_start.isoformat(),
        "status": "active"
    }
    library = inlibrary.get_library()
    d['library'] = library and library.key
    d['geoip_country'] = geo_ip.get_country(web.ctx.ip)
    statsdb.add_entry(key, d)