Exemplo n.º 1
0
 def update_fop_exchange_data(self, exchange_data, fop):
     already_stored_exchange_data = ExchangeDataFop.objects.filter(
         fop_id=fop.id)
     self.time_it('trying get exchange_data')
     for answer in exchange_data:
         authority, taxpayer_type, start_date, start_number, end_date, end_number \
             = self.extract_exchange_data(answer)
         self.time_it('getting exchange_data from record')
         if (not authority and not taxpayer_type and not start_date
                 and not start_number and not end_date and not end_number):
             continue
         already_stored = False
         for stored_exchange_data in already_stored_exchange_data:
             # ToDo: find way to check dates
             if (stored_exchange_data.authority_id == authority.id
                     if authority else
                     None and stored_exchange_data.taxpayer_type_id
                     == taxpayer_type.id if taxpayer_type else None
                     and stored_exchange_data.start_number == start_number
                     and stored_exchange_data.end_number == end_number):
                 already_stored = True
                 break
         if not already_stored:
             exchange_data = ExchangeDataFop(fop=fop,
                                             authority=authority,
                                             taxpayer_type=taxpayer_type,
                                             start_date=start_date,
                                             start_number=start_number,
                                             end_date=end_date,
                                             end_number=end_number)
             self.bulk_manager.add(exchange_data)
Exemplo n.º 2
0
 def update_fop_exchange_data(self, exchange_data, fop):
     already_stored_exchange_data = ExchangeDataFop.objects.filter(fop=fop)
     for answer in exchange_data:
         authority, taxpayer_type, start_date, start_number, end_date, end_number \
             = self.extract_exchange_data(answer)
         if (not authority and not taxpayer_type and not start_date
                 and not start_number and not end_date and not end_number):
             continue
         already_stored = False
         for stored_exchange_data in already_stored_exchange_data:
             # ToDo: find way to check dates
             if (stored_exchange_data.authority == authority
                     and stored_exchange_data.taxpayer_type == taxpayer_type
                     and stored_exchange_data.start_number == start_number
                     and stored_exchange_data.end_number == end_number):
                 already_stored = True
                 break
         if not already_stored:
             exchange_data = ExchangeDataFop(fop=fop,
                                             authority=authority,
                                             taxpayer_type=taxpayer_type,
                                             start_date=start_date,
                                             start_number=start_number,
                                             end_date=end_date,
                                             end_number=end_number)
             self.bulk_manager.add(exchange_data)
Exemplo n.º 3
0
 def add_fop_exchange_data_to_dict(self, exchange_data, code):
     all_fop_exchangedata = []
     for answer in exchange_data:
         authority, taxpayer_type, start_date, start_number, end_date, end_number \
             = self.extract_exchange_data(answer)
         if (not authority and not taxpayer_type and not start_date
                 and not start_number and not end_date and not end_number):
             continue
         exchange_data = ExchangeDataFop(authority=authority, taxpayer_type=taxpayer_type,
                                         start_date=start_date, start_number=start_number,
                                         end_date=end_date, end_number=end_number)
         all_fop_exchangedata.append(exchange_data)
     if len(all_fop_exchangedata):
         self.new_fops_exchange_data[code] = all_fop_exchangedata