Skip to content

Instantly share code, notes, and snippets.

@rpq
Created January 14, 2016 18:49
Show Gist options
  • Save rpq/6c2f36a71a6cc339dcbc to your computer and use it in GitHub Desktop.
Save rpq/6c2f36a71a6cc339dcbc to your computer and use it in GitHub Desktop.
def _client_specific_post_standard_scrub_updates_ccrd(self):
kwargs = {'client': self.client, 'infile': self.client_infile.infile}
if self.client_infile.commodity in ('E', 'G'):
kwargs['commodity'] = self.client_infile.commodity
kwargs['rate_plan_type__rate_plan_type_abbrev'] = 'var'
kwargs['svc_start_date__isnull'] = False
kwargs['svc_start_date__lt'] = F('file_date')
# add transaction block
service_end_date = self.file_date + datetime.timedelta(months=6)
CustomerCountsRaw.objects.filter(**kwargs).update(
svc_end_date=service_end_date)
del kwargs['svc_start_date__lt']
kwargs['svc_start_date__gte'] = F('file_date')
ccr = CustomerCountsRaw.objects.filter(**kwargs)
for c in ccr.iterator():
service_end_date = service_start_date + datetime.timedelta(months=6)
c.svc_end_date = service_end_date
c.save()
# add contract_type_exp stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment