def get_collection_with_items_for_client(cid, myrefsets, myredis, mydao, include_history=False):
    collection_obj = Collection.query.get(cid)
    collection_doc = get_collection_doc_from_object(collection_obj)
    if not collection_doc:
        return (None, None)

    collection_doc["items"] = []
    tiids = collection_obj.tiids

    if tiids:
        item_metric_dicts = get_readonly_item_metric_dicts(tiids)

        for tiid in item_metric_dicts:
            #logger.info(u"got item {tiid} for {cid}".format(
            #    tiid=item_obj.tiid, cid=cid))
            try:
                item_for_client = item_module.build_item_for_client(item_metric_dicts[tiid], myrefsets, myredis)
            except (KeyError, TypeError, __HOLE__):
                logger.info(u"Couldn't build item {tiid}, excluding it from the returned collection {cid}".format(
                    tiid=tiid, cid=cid))
                item_for_client = None
                raise
            if item_for_client:
                collection_doc["items"] += [item_for_client]
    
    something_currently_updating = not is_all_done(tiids, myredis)

    # logger.debug(u"Got items for collection_doc %s" %cid)

    return (collection_doc, something_currently_updating)
dataset/ETHPy150Open Impactstory/total-impact-core/totalimpact/collection.py/get_collection_with_items_for_client