Guest User

Untitled

a guest
Feb 16th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. updateDelay(prediction_arr,prediction_dep) {
  2. this.state.chartDataWake = [...this.state.chartDataWake, {wake: this.state.wake===84.73 ? "H" : (this.state.wake===14.78 ? "M" : "L"), delay: prediction_arr}];
  3. this.state.chartDataTurnaround = [...this.state.chartDataTurnaround, {turnaround: this.state.schedTurnd, delay: prediction_arr}];
  4.  
  5. this.setState({
  6. prediction_arr: prediction_arr,
  7. prediction_dep: prediction_dep,
  8. delay_arr_cat: prediction_arr===0 ? "<15" : (prediction_arr===1 ? "[15; 45]" : ">45")
  9. });
  10. };
  11.  
  12. this.state.chartDataTurnaround = [...this.state.chartDataTurnaround, {turnaround: this.state.schedTurnd, delay: prediction_arr}];
  13.  
  14. updateDelay(prediction_arr,prediction_dep) {
  15. this.setState(prevState => ({
  16. prediction_arr: prediction_arr,
  17. prediction_dep: prediction_dep,
  18. delay_arr_cat: prediction_arr===0 ? "<15" : (prediction_arr===1 ? "[15; 45]" : ">45"),
  19.  
  20. chartDataWake: [
  21. ...prevState.chartDataWake,
  22. {wake: prevState.wake===84.73 ? "H" : (prevState.wake===14.78 ? "M" : "L"), delay: prediction_arr}
  23. ],
  24.  
  25. chartDataTurnaround: [
  26. ...prevState.chartDataTurnaround,
  27. {turnaround: prevState.schedTurnd, delay: prediction_arr}
  28. ]
  29. }));
  30. };
  31.  
  32. updateDelay(prediction_arr, prediction_dep) {
  33. const newChartDataWake = [...this.state.chartDataWake, {
  34. wake: this.state.wake === 84.73 ? "H" : (this.state.wake === 14.78 ? "M" : "L"),
  35. delay: prediction_arr
  36. }];
  37.  
  38. const newChartDataTurnaround = [...prevState.chartDataTurnaround, {
  39. turnaround: prevState.schedTurnd,
  40. delay: prediction_arr
  41. }]
  42.  
  43.  
  44.  
  45. this.setState(prevState => {
  46. return {
  47. chartDataWake: newChartDataWake
  48. chartDataTurnaround: newChartDataTurnaround
  49. prediction_arr: prediction_arr,
  50. prediction_dep: prediction_dep,
  51. delay_arr_cat: prediction_arr === 0 ? "<15" : (prediction_arr === 1 ? "[15; 45]" : ">45")
  52. }
  53. });
  54. };
  55.  
  56. this.setState((prevState,props) =>
  57. ({
  58. chartDataWake:[...prevState.chartDataWake, {wake: prevState.wake===84.73
  59. ? "H" : (prevState.wake===14.78 ? "M" : "L"), delay: prediction_arr}],
  60. chartDataTurnaround = [...prevState.chartDataTurnaround, {turnaround:
  61. prevState.schedTurnd, delay: prediction_arr}],
  62. prediction_arr: prediction_arr,
  63. prediction_dep: prediction_dep,
  64. delay_arr_cat: prediction_arr===0 ? "<15" : (prediction_arr===1 ? "[15;
  65. 45]" : ">45")
  66. })
Add Comment
Please, Sign In to add comment