comparison client/src/store/fairwayavailability.js @ 3351:dcae9b3e864b

available_fairway_depths: remove mocks
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 21 May 2019 12:37:48 +0200
parents cd745be63f71
children 399a2eb496ee
comparison
equal deleted inserted replaced
3350:8da2f7b9a04b 3351:dcae9b3e864b
17 17
18 const FREQUENCIES = { 18 const FREQUENCIES = {
19 MONTHLY: "monthly", 19 MONTHLY: "monthly",
20 QUARTERLY: "quarterly", 20 QUARTERLY: "quarterly",
21 YEARLY: "yearly" 21 YEARLY: "yearly"
22 };
23
24 /**
25 * Maximum number of hours:
26 * Month: approx 744/720/672 hours for 31/30/21 days
27 * Quarter: aprrox 2160 per quarter (~90 days)
28 * Yearly: approx 8760 per year (~365 days)
29 */
30 const MOCKDATA = {
31 [FREQUENCIES.MONTHLY]: `
32 #label,# >= LDC [h],# < 200.00 [h],# >= 200.00 [h],# >= 230.00 [h],# >= 250.00 [h]
33 05-2018,670.000,450.000,70.000,50.000,100.000
34 06-2018,669.000,546.000,0.000,0.000,123.000
35 07-2018,671.000,377.000,0.000,0.000,294.000
36 08-2018,668.000,168.000,0.000,0.000,500.000
37 09-2018,673.000,23.000,0.000,0.000,650.000
38 10-2018,670.000,4.000,0.000,0.000,666.000
39 11-2018,672.000,1.000,0.000,0.000,671.000
40 12-2018,675.000,5.000,0.000,0.000,670.000
41 01-2019,677.000,0.000,0.000,0.000,677.000
42 02-2019,668.000,43.000,0.000,0.000,625.000
43 03-2019,660.000,49.000,0.000,0.000,611.000
44 04-2019,620.000,20.000,0.000,0.000,600.000
45 05-2019,672.000,42.000,0.000,0.000,630.000`,
46 [FREQUENCIES.QUARTERLY]: `
47 #label,# >= LDC [h],# < 200.00 [h],# >= 200.00 [h],# >= 230.00 [h],# >= 250.00 [h]
48 Q2-2018,989.000, 500.000,240.000,260.000,1823.000
49 Q3-2018,1108.000,500.000,180.000,320.000,1956.000
50 Q3-2018,1145.000,500.000,250.000,250.000,2001.000
51 Q1-2019,1155.000,500.000,400.000,100.000,2021.000
52 Q2-2019,1160.000,500.000,300.000,200.000,1998.000`,
53 [FREQUENCIES.YEARLY]: `
54 #label,# >= LDC [h],# < 200.00 [h],# >= 200.00 [h],# >= 230.00 [h],# >= 250.00 [h]
55 2018,8360.000,0.000,0.000,0.000,7360.000
56 2019,8153.000,0.000,0.000,0.000,7250.000`
57 }; 22 };
58 23
59 const init = () => { 24 const init = () => {
60 return { 25 return {
61 type: "bottlenecks", 26 type: "bottlenecks",
121 )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}`; 86 )}?from=${from}T${start}&to=${to}T${end}&mode=${frequency}&los=${LOS}`;
122 HTTP.get(URL, { 87 HTTP.get(URL, {
123 headers: { "X-Gemma-Auth": localStorage.getItem("token") } 88 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
124 }) 89 })
125 .then(response => { 90 .then(response => {
126 //const { data } = response; 91 const { data } = response;
127 const data = MOCKDATA[frequency];
128 console.log(data);
129 const csv = data.split("\n").filter(x => x !== ""); //omit empty lines 92 const csv = data.split("\n").filter(x => x !== ""); //omit empty lines
130 commit("setLegend", csv.shift()); 93 commit("setLegend", csv.shift());
131 let transformed = csv.map(e => { 94 let transformed = csv.map(e => {
132 const result = e.split(","); 95 const result = e.split(",");
133 const label = result.shift(); 96 const label = result.shift();