Mercurial > gemma
comparison client/src/lib/classifications.js @ 3507:a606d003730c
client: spuc12: implemented diagram for reference gauge of bottlenecks
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 28 May 2019 14:52:57 +0200 |
parents | b6dd09044951 |
children | bcf9713ee359 |
comparison
equal
deleted
inserted
replaced
3506:e2ed741545e1 | 3507:a606d003730c |
---|---|
9 * Software engineering by Intevation GmbH | 9 * Software engineering by Intevation GmbH |
10 * | 10 * |
11 * Author(s): | 11 * Author(s): |
12 * Raimund Renkert <raimund.renkert@intevation.de> | 12 * Raimund Renkert <raimund.renkert@intevation.de> |
13 */ | 13 */ |
14 | |
15 const getGauge = f => { | |
16 if (f.getId().indexOf("bottlenecks") > -1) { | |
17 return f.get("gauge_obj"); | |
18 } | |
19 return f; | |
20 }; | |
14 | 21 |
15 export default { | 22 export default { |
16 surveyCurrency(bottleneck) { | 23 surveyCurrency(bottleneck) { |
17 if ( | 24 if ( |
18 bottleneck.get("revisiting_time") === null || | 25 bottleneck.get("revisiting_time") === null || |
32 return "yellow"; | 39 return "yellow"; |
33 } else if (revTime * 1.5 < diff) { | 40 } else if (revTime * 1.5 < diff) { |
34 return "red"; | 41 return "red"; |
35 } | 42 } |
36 }, | 43 }, |
37 gmAvailability(gauge) { | 44 gmAvailability(feature) { |
45 let gauge = getGauge(feature); | |
38 let gmDate = gauge.get("gm_measuredate"); | 46 let gmDate = gauge.get("gm_measuredate"); |
39 let gmN = gauge.get("gm_n_14d"); | 47 let gmN = gauge.get("gm_n_14d"); |
40 if ( | 48 if ( |
41 gmDate !== undefined && | 49 gmDate !== undefined && |
42 gmDate !== null && | 50 gmDate !== null && |
50 } | 58 } |
51 return "yellow"; | 59 return "yellow"; |
52 } | 60 } |
53 return "red"; | 61 return "red"; |
54 }, | 62 }, |
55 forecastAccuracy(gauge) { | 63 forecastAccuracy(feature) { |
64 let gauge = getGauge(feature); | |
56 let fa3d = gauge.get("forecast_accuracy_3d"); | 65 let fa3d = gauge.get("forecast_accuracy_3d"); |
57 let fa1d = gauge.get("forecast_accuracy_1d"); | 66 let fa1d = gauge.get("forecast_accuracy_1d"); |
58 if (typeof fa3d == "number" && typeof fa1d == "number") { | 67 if (typeof fa3d == "number" && typeof fa1d == "number") { |
59 if (fa1d > 15) { | 68 if (fa1d > 15) { |
60 return "red"; | 69 return "red"; |
64 return "lime"; | 73 return "lime"; |
65 } | 74 } |
66 } | 75 } |
67 return "white"; | 76 return "white"; |
68 }, | 77 }, |
69 forecastVsReality(gauge) { | 78 forecastVsReality(feature) { |
79 let gauge = getGauge(feature); | |
70 let nsc = gauge.get("nsc_data"); | 80 let nsc = gauge.get("nsc_data"); |
71 if (nsc && nsc.coeffs.reduce((sum, coeff) => sum + coeff.samples, 0)) { | 81 if (nsc && nsc.coeffs.reduce((sum, coeff) => sum + coeff.samples, 0)) { |
72 // 24h < 12.5 | 82 // 24h < 12.5 |
73 if (nsc.coeffs[0].samples && nsc.coeffs[0].value < -12.5) return "red"; | 83 if (nsc.coeffs[0].samples && nsc.coeffs[0].value < -12.5) return "red"; |
74 // 72h < 12.5 | 84 // 72h < 12.5 |