Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-32651

Incorrectly calculed reporting period can lead to an empty report

    XMLWordPrintable

Details

    Description

      Currently, calculating the begin date of the reporting period is done using Calendar.roll() which is wrong. As roll() only changes a specific unit and doesn't update larger fields in the calendar object, rolling back 2 week on the first week of a month sets the calendar week to the last week of the month, which is in the future. As the begin date is in the future, the computed is empty.

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Yoann Dubreuil
            Path:
            src/main/java/jenkins/plugins/build_metrics/BuildMetricsPluginSearchFactory.java
            http://jenkins-ci.org/commit/build-metrics-plugin/3b1025444b648a162f7090ae4fa502d2dfe9d167
            Log:
            JENKINS-32651 Fix calculation of report begin date

            Currently, computation is done using Calendar.roll() which is wrong.
            roll() only changes a specific unit and doesn't update larger fields.
            For example, rolling back 2 week on the first week of a month sets
            the calendar week to the last week of the month, which is in the future.
            Obviously, when the begin date is in the future, there's nothing in the
            report.

            Using Calendar.add() with a negative value substracts the right amount
            of time from the current time.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yoann Dubreuil Path: src/main/java/jenkins/plugins/build_metrics/BuildMetricsPluginSearchFactory.java http://jenkins-ci.org/commit/build-metrics-plugin/3b1025444b648a162f7090ae4fa502d2dfe9d167 Log: JENKINS-32651 Fix calculation of report begin date Currently, computation is done using Calendar.roll() which is wrong. roll() only changes a specific unit and doesn't update larger fields. For example, rolling back 2 week on the first week of a month sets the calendar week to the last week of the month, which is in the future. Obviously, when the begin date is in the future, there's nothing in the report. Using Calendar.add() with a negative value substracts the right amount of time from the current time.

            Code changed in jenkins
            User: Yoann Dubreuil
            Path:
            .gitignore
            pom.xml
            src/test/java/jenkins/plugins/build_metrics/stats/StatsFactoryTest.java
            src/test/java/jenkins/plugins/build_metrics/stats/StatsMathTest.java
            http://jenkins-ci.org/commit/build-metrics-plugin/e13d28d82d02c37fecbf3063adabca67e78c3071
            Log:
            JENKINS-32651 Bump core dependency to 1.509 + fix tests

            This is required to build against JDK 7/8

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yoann Dubreuil Path: .gitignore pom.xml src/test/java/jenkins/plugins/build_metrics/stats/StatsFactoryTest.java src/test/java/jenkins/plugins/build_metrics/stats/StatsMathTest.java http://jenkins-ci.org/commit/build-metrics-plugin/e13d28d82d02c37fecbf3063adabca67e78c3071 Log: JENKINS-32651 Bump core dependency to 1.509 + fix tests This is required to build against JDK 7/8

            Fixed in 1.1

            ydubreuil Yoann Dubreuil added a comment - Fixed in 1.1
            kcorlett Kelly Corlett added a comment -

            Thanks Yoann

            kcorlett Kelly Corlett added a comment - Thanks Yoann

            People

              ydubreuil Yoann Dubreuil
              ydubreuil Yoann Dubreuil
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: