def save_everything(items, index=False, backscrape=False): docket, af = items["docket"], items["audio_file"] docket.save() af.docket = docket af.save(index=index) candidate_judges = [] if af.docket.court_id != "scotus": if af.judges: candidate_judges = get_candidate_judges(af.judges, docket.court.pk, af.docket.date_argued) else: candidate_judges = get_scotus_judges(af.docket.date_argued) for candidate in candidate_judges: af.panel.add(candidate) if not backscrape: RealTimeQueue.objects.create(item_type=SEARCH_TYPES.ORAL_ARGUMENT, item_pk=af.pk)
def save_everything(self, items, index=False, backscrape=False): docket, af = items['docket'], items['audio_file'] docket.save() af.docket = docket af.save(index=index) candidate_judges = [] if af.docket.court_id != 'scotus': if af.judges: candidate_judges = get_candidate_judges( af.judges, docket.court.pk, af.docket.date_argued, ) else: candidate_judges = get_scotus_judges(af.docket.date_argued) for candidate in candidate_judges: af.panel.add(candidate) if not backscrape: RealTimeQueue.objects.create(item_type='oa', item_pk=af.pk)
def save_everything( items: Dict[str, Union[Docket, Audio]], index: bool = False, backscrape: bool = False, ) -> None: docket, af = items["docket"], items["audio_file"] docket.save() af.docket = docket af.save(index=index) candidate_judges = [] if af.docket.court_id != "scotus": if af.judges: candidate_judges = lookup_judges_by_messy_str( af.judges, docket.court.pk, af.docket.date_argued) else: candidate_judges = get_scotus_judges(af.docket.date_argued) for candidate in candidate_judges: af.panel.add(candidate) if not backscrape: RealTimeQueue.objects.create(item_type=SEARCH_TYPES.ORAL_ARGUMENT, item_pk=af.pk)