Opened 11 years ago
Closed 11 years ago
#496 closed defect (fixed)
Sample source reports should initialize table data from new sites correctly
Reported by: | olle | Owned by: | olle |
---|---|---|---|
Priority: | minor | Milestone: | Reggie v2.12 |
Component: | net.sf.basedb.reggie | Keywords: | |
Cc: |
Description
Sample source reports should initialize table data from new sites correctly:
- Cells in columns for time periods before the start date of the site should be initialized to an empty string instead of 0.
- Cells in columns for time periods after or including the start date of the site should be initialized to 0, as should percentage and sum values.
Change History (3)
comment:1 by , 11 years ago
Status: | new → assigned |
---|
comment:2 by , 11 years ago
Problem description:
When the sample source reports were first developed, all sites had start dates in the first year, 2010, and all sites had some data entries in the database. The code was therefore written with this background. However, when preparing for new sites to be added, a number of problems appeared:
- Cells in columns for time periods before the start date of the site was only correct for the year view, otherwise some cells were initialized to 0 and some to an empty string, depending on the time period in the year for the cell and the start date. Especially the week view showed odd cell initialization for weeks near the start and end of a year (see more detailed description below). The cell data initialization is performed in JavaScript function
addDataRowsToTable(report, reportTable)
in JSP filesamplereportgenerator.jsp
inreggie/resources/reports/
. - Cells for percentage values showed "
NaN%
" instead of "0%
", which could be traced to a bug in JavaScript functiongetJSONDataWithPercent(jsonObject, key, sumKey, numDecimals)
in JSP filesamplereportgenerator.jsp
inreggie/resources/reports/
. - The overview table of detailed patient data contained "
undefined
" instead of "0
" in the sum column cells for sites without data. This is caused by data for JSON key "sumKey
" not being properly initialized in private methodJSONObject createOverviewReport(DbControl dc, JSONObject json, Date startDate, Date endDate)
in servletSampleReportServlet
inreggie/src/net/sf/basedb/reggie/servlet/
.
Problem with comparing ISO week numbers:
ISO week numbers are tricky in their short form (without being coupled to a year), since days in different years may lie in the same week, and days at the start of a year may have week number 52 or 53 of the previous year and days at the end of a year may have week number 01 of the next year.
Example: Monday 2012-01-02 has week number 2012-01, Monday 2012-12-31 has week number 2013-01, thus two days at the beginning and end of the same year have the same short week number 01.
A working procedure for comparing the week numbers of two dates should be:
a. If current date is before site start date - 6 days, it is in a previous week.
b. If current date is within site start date +/- 6 days and not in the same week, check dates.
Just checking week numbers in the last case leads to e.g. 2012-12-30 (w52) > 2012-12-31 (w01).
comment:3 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
(In [2000]) Fixes #496. Sample source reports updated to initialize table data from new sites correctly:
- JSP file
samplereportgenerator.jsp
inreggie/resources/reports/
updated in JavaScript functionaddDataRowsToTable(report, reportTable)
to initialize cells in columns for time periods before the start date of the site to an empty string. - JSP file
samplereportgenerator.jsp
inreggie/resources/reports/
updated in JavaScript functiongetJSONDataWithPercent(jsonObject, key, sumKey, numDecimals)
by fix of bug (condition "dataSum != null || dataSum != 0
" corrected to "dataSum != null && dataSum != 0
"). - Servlet
SampleReportServlet
inreggie/src/net/sf/basedb/reggie/servlet/
updated in private methodJSONObject createOverviewReport(DbControl dc, JSONObject json, Date startDate, Date endDate)
to initialize data for JSON key "sumKey
".
Ticket accepted.