Code review comment for lp:~pkunal-parmar/ubuntu-calendar-app/nextYearFix

Revision history for this message
Olivier Tilloy (osomon) wrote :

This fixes the issue raised by Jacek. However this code could be made much easier to read. How about:

    property var year: getDateFromYear(getYear())
    function getYear() {
        switch( root.indexType(index)) {
        case 0:
            return currentYear.getFullYear() - 1
        case -1:
            return currentYear.getFullYear() + 1
        case 1:
            return currentYear.getFullYear()
        }
    }

And while we’re at it, I don’t understand how come case 0 is not for current year, -1 for previous and +1 for next, as function indexType(…) documents it. This is confusing, can you shed a light on this?

review: Needs Fixing

« Back to merge proposal