def datespan_from_beginning(domain_object, timezone): if use_new_exports(domain_object.name): startdate = domain_object.date_created else: startdate = get_first_form_submission_received(domain_object.name) now = datetime.utcnow() datespan = DateSpan(startdate, now, timezone=timezone) datespan.is_default = True return datespan
def datespan_from_beginning(domain_object, timezone): from corehq import toggles if toggles.NEW_EXPORTS.enabled(domain_object.name): startdate = domain_object.date_created else: startdate = get_first_form_submission_received(domain_object.name) now = datetime.utcnow() datespan = DateSpan(startdate, now, timezone=timezone) datespan.is_default = True return datespan
def test_get_first_form_submission_received(self): self.assertEqual(get_first_form_submission_received(self.domain), self.now - self._60_days)
def datespan_from_beginning(domain, timezone): now = datetime.utcnow() startdate = get_first_form_submission_received(domain) datespan = DateSpan(startdate, now, timezone=timezone) datespan.is_default = True return datespan
def first_form_submission(domain, display=True): try: submission_time = get_first_form_submission_received(domain) except ValueError: return None return display_time(submission_time, display) if submission_time else None