Exemplo n.º 1
0
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
Exemplo n.º 2
0
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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
 def test_get_first_form_submission_received(self):
     self.assertEqual(get_first_form_submission_received(self.domain),
                      self.now - self._60_days)
Exemplo n.º 5
0
 def test_get_first_form_submission_received(self):
     self.assertEqual(get_first_form_submission_received(self.domain), self.now - self._60_days)
Exemplo n.º 6
0
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
Exemplo n.º 7
0
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
Exemplo n.º 8
0
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