def _update_caches_with_influx_data(
    organisation_info_cache_dict: OrganisationSubscriptionInformationCacheDict,
) -> None:
    """
    Mutates the provided organisation_info_cache_dict in place to add information about the organisation's
    influx usage.
    """
    if not settings.INFLUXDB_TOKEN:
        return

    for _date_start, limit in (("-30d", ""), ("-7d", ""), ("-24h", "100")):
        key = f"api_calls_{_date_start[1:]}"

        now = timezone.now()
        if _date_start.endswith("d"):
            date_start = now - timedelta(days=int(_date_start[1:-1]))
        elif _date_start.endswith("h"):
            date_start = now - timedelta(hours=int(_date_start[1:-1]))
        else:
            assert False, "Expecting either days (d) or hours (h)"  # pragma: no cover

        org_calls = get_top_organisations(date_start, limit)

        covered_orgs = set()

        for org_id, calls in org_calls.items():
            subscription_info_cache = organisation_info_cache_dict.get(org_id)
            covered_orgs.add(org_id)

            if not subscription_info_cache:
                # I don't think this is a valid case but worth checking / handling
                continue
            setattr(subscription_info_cache, key, calls)

        for org_id in organisation_info_cache_dict:
            if org_id not in covered_orgs:
                subscription_info_cache = organisation_info_cache_dict.get(org_id)
                setattr(subscription_info_cache, key, 0)

    Mutates the provided organisation_info_cache_dict in place to add information about the organisation's
    influx usage.
    
api/organisations/subscription_info_cache.py