def toPrimeGrant(soapDict): modelAttrs = flattenSoapDict(_primeGrant, _grantAddrs, 'cfda_numbers', soapDict) modelAttrs['subawards'] = [ toSubgrant(sub) for sub in soapDict.get('subawardees', []) ] return FSRSGrant(**modelAttrs)
def to_prime_grant(soap_dict): model_attrs = flatten_soap_dict(_primeGrant, _grantAddrs, 'cfda_numbers', soap_dict) model_attrs['subawards'] = [to_subgrant(sub) for sub in soap_dict.get('subawardees', [])] debug_dict = {'id': model_attrs['id'], 'internal_id': model_attrs['internal_id'], 'subaward_count': len(model_attrs['subawards'])} logger.debug('Grant: %s' % str(debug_dict)) return FSRSGrant(**model_attrs)
def test_next_id(no_award_db): no_award_db.add_all([ FSRSProcurementFactory(id=5), FSRSProcurementFactory(id=3), FSRSGrantFactory(id=2) ]) no_award_db.commit() assert 6 == FSRSProcurement.next_id(no_award_db) assert 3 == FSRSGrant.next_id(no_award_db)
def to_prime_grant(soap_dict): """ Extracts Prime Grant object from soap dictionary Args: soap_dict: soap dictionary to parse Returns: Prime Grant object """ model_attrs = flatten_soap_dict(_primeGrant, _grantAddrs, 'cfda_numbers', soap_dict) model_attrs['subawards'] = [to_subgrant(sub) for sub in soap_dict.get('subawardees', [])] debug_dict = {'id': model_attrs['id'], 'internal_id': model_attrs['internal_id'], 'subaward_count': len(model_attrs['subawards'])} logger.debug('Grant: %s' % str(debug_dict)) return FSRSGrant(**model_attrs)
def test_next_id(no_award_db): no_award_db.add_all([FSRSProcurementFactory(id=5), FSRSProcurementFactory(id=3), FSRSGrantFactory(id=2)]) no_award_db.commit() assert 6 == FSRSProcurement.next_id(no_award_db) assert 3 == FSRSGrant.next_id(no_award_db)