<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7249</bug_id>
          
          <creation_ts>2015-01-26 11:34:36 +0000</creation_ts>
          <short_desc>Yesterday&apos;s builds filter shows today&apos;s builds instead of yesterday&apos;s</short_desc>
          <delta_ts>2015-11-26 14:47:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Toaster</product>
          <component>toaster</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>VERIFIED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.8 M4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Belen Barros Pena">belen.barros.pena</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          <cc>alexandru.costinx.roman</cc>
    
    <cc>alexandru.damian</cc>
    
    <cc>belen.barros.pena</cc>
    
    <cc>bluelightning</cc>
    
    <cc>cristiana.voicu</cc>
    
    <cc>dave.lerner</cc>
    
    <cc>jessica.zhang</cc>
          
          <qa_contact name="Alexandru Roman">alexandru.costinx.roman</qa_contact>
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>48274</commentid>
    <comment_count>0</comment_count>
    <who name="Belen Barros Pena">belen.barros.pena</who>
    <bug_when>2015-01-26 11:34:36 +0000</bug_when>
    <thetext>This happens both in:

- the all builds table
- the project builds table

To reproduce, build something with Toaster. Once the build is done, go to the all builds table and open the completed on filters. Select the &apos;yesterday&apos;s builds&apos; option. You will see the build you just run listed there.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49460</commentid>
    <comment_count>1</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2015-03-15 07:37:07 +0000</bug_when>
    <thetext>It turns out that &quot;today&quot; was also broken, at least for all people outside of UTC+0 (e.g. London). 

That is because &quot;timezone.now()&quot; is always UTC+0 regardless of the current time zone, and you have to use &quot;timezone.localtime(timezone.now())&quot; instead.

Also, while &quot;strftime(&quot;%Y-%m-%d&quot;)&quot; gives free truncation to the beginning of the day, in YP-1.8 that is for some reason no longer being used in the selector count fields for the pop-up, so it has to be compensated for.

Here is new code to calculate for both the local time zone and the explicit beginning of days.

        # calculate the exact begining of local today and yesterday
        today_begin = timezone.localtime(timezone.now());
        todays_seconds = int(today_begin.strftime(&quot;%H&quot;))*60*60+int(today_begin.strftime(&quot;%M&quot;))*60+int(today_begin.strftime(&quot;%S&quot;));
        today_begin = timezone.now()-timedelta(seconds=todays_seconds);
        yesterday_begin = today_begin-timedelta(days=1);

... and this example filter ...

	(&quot;Today&apos;s builds&quot; , &apos;created__gte:&apos;+str(today_begin), queryset_all.filter(created__gte=today_begin).count()),
	(&quot;Yesterday&apos;s builds&quot;,
	  &apos;created__gte!created__lt:&apos;
		 +yesterday_begin.strftime(&quot;%Y-%m-%d&quot;)+&apos;!&apos;
		 +today_begin.strftime(&quot;%Y-%m-%d&quot;),
	  queryset_with_search.filter(
		 created__gte=yesterday_begin,
		 created__lt=today_begin
		 ).count()),</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49461</commentid>
    <comment_count>2</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2015-03-15 07:41:37 +0000</bug_when>
    <thetext>( and yes I did test it watching the clock in California go from 11:59pm to 12.01am for the next day, and observe the expected shift in &quot;today&apos;s&quot; and &quot;yesterday&apos;s&quot; build counts and filtering)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>56808</commentid>
    <comment_count>3</comment_count>
    <who name="Alexandru Roman">alexandru.costinx.roman</who>
    <bug_when>2015-11-26 14:47:26 +0000</bug_when>
    <thetext>Verified.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>