Browse Source

Fix XML generation

Neal Wilson 6 years ago
parent
commit
c6ad7cd6c3
1 changed files with 55 additions and 52 deletions
  1. 55
    52
      config/Reports/historyreport.xml

+ 55
- 52
config/Reports/historyreport.xml View File

@@ -238,68 +238,71 @@
238 238
                     output.writeEmptyElement("td");
239 239
                     if(query.value(17).length > 0) {
240 240
                         extradata = JSON.parse(query.value(17));
241
-                        wcolor = "#000000";
242
-                        gcolor = "#000000";
243
-                        wtitle = "";
244
-                        gtitle = "";
245
-                        if(query.value(18).length > 0) {
246
-                            specdata = JSON.parse(query.value(18));
247
-                            if(extradata.color.whole && specdata.color.whole.expected) {
248
-                                wmin = Number(specdata.color.whole.expected);
249
-                                wmax = wmin;
250
-                                wtitle += specdata.color.whole.expected;
251
-                                if(specdata.color.whole.tolerance) {
252
-                                    wmin -= Number(specdata.color.whole.tolerance);
253
-                                    wmax += Number(specdata.color.whole.tolerance);
254
-                                    wtitle += "±";
255
-                                    wtitle += specdata.color.whole.tolerance;
241
+                        if(extradata.color) {
242
+                            wcolor = "#000000";
243
+                            gcolor = "#000000";
244
+                            wtitle = "";
245
+                            gtitle = "";
246
+                            if(query.value(18).length > 0) {
247
+                                specdata = JSON.parse(query.value(18));
248
+                                if(extradata.color.whole && specdata.color.whole.expected) {
249
+                                    wmin = Number(specdata.color.whole.expected);
250
+                                    wmax = wmin;
251
+                                    wtitle += specdata.color.whole.expected;
252
+                                    if(specdata.color.whole.tolerance) {
253
+                                        wmin -= Number(specdata.color.whole.tolerance);
254
+                                        wmax += Number(specdata.color.whole.tolerance);
255
+                                        wtitle += "±";
256
+                                        wtitle += specdata.color.whole.tolerance;
257
+                                    }
258
+                                    if(Number(extradata.color.whole) < wmin || Number(extradata.color.whole) > wmax) {
259
+                                        wcolor = "#FF0000";
260
+                                    } else {
261
+                                        wcolor = "#00FF00";
262
+                                    }
256 263
                                 }
257
-                                if(Number(extradata.color.whole) < wmin || Number(extradata.color.whole) > wmax) {
258
-                                    wcolor = "#FF0000";
259
-                                } else {
260
-                                    wcolor = "#00FF00";
264
+                                if(extradata.color.ground && specdata.color.ground.expected) {
265
+                                    gmin = Number(specdata.color.ground.expected);
266
+                                    gmax = gmin;
267
+                                    gtitle += specdata.color.ground.expected;
268
+                                    if(specdata.color.ground.tolerance) {
269
+                                        gmin -= Number(specdata.color.ground.tolerance);
270
+                                        gmax += Number(specdata.color.ground.tolerance);
271
+                                        gtitle += "±";
272
+                                        gtitle += specdata.color.ground.tolerance;
273
+                                    }
274
+                                    if(Number(extradata.color.ground) < gmin || Number(extradata.color.ground) > gmax) {
275
+                                        gcolor = "#FF0000";
276
+                                    } else {
277
+                                        gcolor = "#00FF00";
278
+                                    }
261 279
                                 }
262 280
                             }
263
-                            if(extradata.color.ground && specdata.color.ground.expected) {
264
-                                gmin = Number(specdata.color.ground.expected);
265
-                                gmax = gmin;
266
-                                gtitle += specdata.color.ground.expected;
267
-                                if(specdata.color.ground.tolerance) {
268
-                                    gmin -= Number(specdata.color.ground.tolerance);
269
-                                    gmax += Number(specdata.color.ground.tolerance);
270
-                                    gtitle += "±";
271
-                                    gtitle += specdata.color.ground.tolerance;
272
-                                }
273
-                                if(Number(extradata.color.ground) < gmin || Number(extradata.color.ground) > gmax) {
274
-                                    gcolor = "#FF0000";
275
-                                } else {
276
-                                    gcolor = "#00FF00";
277
-                                }
281
+                            output.writeStartElement("td");
282
+                            if(extradata.color.whole) {
283
+                                output.writeStartElement("span");
284
+                                output.writeAttribute("style", "color:"+wcolor);
285
+                                output.writeAttribute("title", wtitle);
286
+                                output.writeCharacters(extradata.color.whole);
287
+                                output.writeEndElement();
278 288
                             }
279
-                        }
280
-                        if(extradata.color.whole) {
281 289
                             output.writeStartElement("span");
282
-                            output.writeAttribute("style", "color:"+wcolor);
283
-                            output.writeAttribute("title", wtitle);
284
-                            output.writeCharacters(extradata.color.whole);
290
+                            if(wcolor === gcolor) {
291
+                                output.writeAttribute("style", "color:"+wcolor);
292
+                            }
293
+                            output.writeCharacters("/");
285 294
                             output.writeEndElement();
286
-                        }
287
-                        output.writeStartElement("span");
288
-                        if(wcolor === gcolor) {
289
-                            output.writeAttribute("style", "color:"+wcolor);
290
-                        }
291
-                        output.writeCharacters("/");
292
-                        output.writeEndElement();
293
-                        if(extradata.color.ground) {
294
-                            output.writeStartElement("span");
295
-                            output.writeAttribute("style", "color:"+gcolor);
296
-                            output.writeAttribute("title", gtitle);
297
-                            output.writeCharacters(extradata.color.ground);
295
+                            if(extradata.color.ground) {
296
+                                output.writeStartElement("span");
297
+                                output.writeAttribute("style", "color:"+gcolor);
298
+                                output.writeAttribute("title", gtitle);
299
+                                output.writeCharacters(extradata.color.ground);
300
+                                output.writeEndElement();
301
+                            }
298 302
                             output.writeEndElement();
299 303
                         }
300 304
                     }
301 305
                     output.writeEndElement();
302
-                    output.writeEndElement();
303 306
                     output.writeStartElement("tr");
304 307
                     output.writeAttribute("valign", "top");
305 308
                     output.writeEmptyElement("td");

Loading…
Cancel
Save