← Back to team overview

dhis2-devs team mailing list archive

Re: define weekly

 

Hi Jason, Morten,

We took a look at the code for the fix:
   var startDate = this.calendar.newDate(year, 1, 1);
    // startDate.add(-(startDate.dayOfWeek() - 1), 'd'); // rewind to start
of week, might cross year boundary

    var day = startDate.dayOfWeek();

    if( day == 0 ) // Sunday (0), forward to Monday
    {
      startDate.add(1, 'd');
    }
    else if( day <= 4 ) // Monday - Thursday, rewind to Monday
    {
      startDate.add(( ( day - 1 ) * -1 ), 'd');
    }
    else
    // Friday - Saturday, forward to Monday
    {
      startDate.add(8 - day, 'd');
    }

We could actually revert back to the previous code of rewinding back to the
start of the week. The only change needed is to set the initial startDate
to *this.calendar.newDate(year, 1, 4)* because as per the Wikipedia page
for ISO weeks <https://en.wikipedia.org/wiki/ISO_week_date>, the first ISO
week of each year always contains January 4th.

Let us know if you'd like us to send through a patch.

Cheers,

-doh

On Thu, Jan 7, 2016 at 6:51 PM, Jason Pickering <jason.p.pickering@xxxxxxxxx
> wrote:

> Hi Marta and Papa,
> We identified the bug (we think) and Morten has updated the code with a
> fix, and backported it back to version 2.17. New builds are available here
> http://ci.dhis2.org/ .
>
> I have tested this on one instance, and it seems to work OK now. Let us
> know if it works for you.
>
> Best regards,
> Jason
>
>
> On Tue, Jan 5, 2016 at 5:14 PM, Marta Vila <martavila@xxxxxxxxx> wrote:
>
>> Hi Jason,
>>
>> we just started receiving emails from users reporting the same problem.
>> Will follow the evolution.
>>
>> Cheers
>>
>>
>> On 4 January 2016 at 18:05, papa alioune Sokhna <sokhnapapa@xxxxxxxxx>
>> wrote:
>>
>>> Hi Jason,
>>> If that information can be useful I noticed that the dhis our Ministry
>>> of Health does not have this problem and they have version 2.15.
>>>
>>> 2016-01-04 16:16 GMT+00:00 Jason Pickering <jason.p.pickering@xxxxxxxxx>
>>> :
>>>
>>>> Hi Papa,
>>>>
>>>> I am able to reproduce this. It is clearly a bug.
>>>>
>>>> I think you should used 2015W53 for this period, but there could be a
>>>> major problem if the weeks for 2016 are off.
>>>>
>>>> Jan/Lars, could you comment?
>>>>
>>>> Regards,
>>>> Jason
>>>>
>>>>
>>>>
>>>> On Mon, Jan 4, 2016 at 4:55 PM, papa alioune Sokhna <
>>>> sokhnapapa@xxxxxxxxx> wrote:
>>>>
>>>>> I noticed in the function given before he repeated in the W53 2015
>>>>> with W1 2016. When you try to enter data we have the following error:
>>>>> One or more data sets for data element does not allow future periods:
>>>>> O6ZD3CjKywK .
>>>>> In attached the screenshots.
>>>>>
>>>>> 2016-01-04 15:31 GMT+00:00 Jason Pickering <
>>>>> jason.p.pickering@xxxxxxxxx>:
>>>>>
>>>>>> Hi Papa,
>>>>>> Could you be more specific?
>>>>>>
>>>>>> December 28th - Jan 3rd should be 2015W53. Usually years have 52
>>>>>> weeks, but this happens from time to time, due to how ISO weeks are
>>>>>> defined.
>>>>>>
>>>>>> Are you seeing this in the analysis modules for last 52 weeks?
>>>>>>
>>>>>> Regards,
>>>>>> Jason
>>>>>>
>>>>>>
>>>>>> On Mon, Jan 4, 2016 at 4:18 PM, papa alioune Sokhna <
>>>>>> sokhnapapa@xxxxxxxxx> wrote:
>>>>>>
>>>>>>> Hello team
>>>>>>> how to define the numbers of weeks on dhis2 because the marking is
>>>>>>> not correct it there's a repitition of the week of December 28, 2015 to
>>>>>>> January 4, 2016.
>>>>>>> Best regards.
>>>>>>>
>>>>>>> --
>>>>>>> Papa Alioune SOKHNA
>>>>>>> *Informaticien *
>>>>>>> Spécialité: développement d'application web, mobile et logiciels surs
>>>>>>> Tel: +221 77 442 16 22
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Jason P. Pickering
>>>>>> email: jason.p.pickering@xxxxxxxxx
>>>>>> tel:+46764147049
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Papa Alioune SOKHNA
>>>>> *Informaticien *
>>>>> Spécialité: développement d'application web, mobile et logiciels surs
>>>>> Tel: +221 77 442 16 22
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jason P. Pickering
>>>> email: jason.p.pickering@xxxxxxxxx
>>>> tel:+46764147049
>>>>
>>>
>>>
>>>
>>> --
>>> Papa Alioune SOKHNA
>>> *Informaticien *
>>> Spécialité: développement d'application web, mobile et logiciels surs
>>> Tel: +221 77 442 16 22
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>
>
> --
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+46764147049
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References