Advertisement
shubhamgoyal

Untitled

Jun 1st, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1.  
  2. Shubham Goyal
  3. ,
  4. 8 mins
  5. ,
  6. New
  7. @mudit sharma
  8.  
  9. export const getCoordinatesFromName = (board, pointName) => {
  10. return board.elementsByName[pointName].getAttributes().originalcoords;
  11. }
  12.  
  13. is a utils function, can also be used in other components, correct?
  14.  
  15. Shubham Goyal
  16. ,
  17. 7 mins
  18. ,
  19. Edited,
  20. New
  21.  
  22. const length1 = calcDistanceBetweenTwoPoints(
  23. pointA,
  24. pointB
  25. );
  26.  
  27. name it lengthAB, what is length1? 😛
  28.  
  29. mudit sharma
  30. ,
  31. 6 mins
  32. ,
  33. New
  34. yes
  35.  
  36. Shubham Goyal
  37. ,
  38. 6 mins
  39. ,
  40. Edited,
  41. New
  42. if(angle.value == "90" && ang.degree != 90) {
  43. const perpendicularSlopeLineBC = calculatePerpendicularSlope(pointB, pointC);
  44. const dummyCoordinates = pointOnLineFromPointAtDistance(pointB, perpendicularSlopeLineBC, length1);
  45. const dummyCoordinate = calcDistanceBetweenTwoPoints(pointA,dummyCoordinates[0]) > calcDistanceBetweenTwoPoints(pointA,dummyCoordinates[1])
  46. ? dummyCoordinates[1]
  47. : dummyCoordinates[0];
  48. const dummyPointObject = getDummyPointObject(dummyCoordinate);
  49. const dummyPoint = createDummyPoint(dummyPointObject, board);
  50. angle.between[0] = dummyPointObject.name;
  51. }
  52.  
  53. should be separated into another other function
  54.  
  55. mudit sharma
  56. ,
  57. 5 mins
  58. ,
  59. New
  60. sure
  61.  
  62. Shubham Goyal
  63. ,
  64. 4 mins
  65. ,
  66. New
  67. const dummyCoordinate = calcDistanceBetweenTwoPoints(pointA,dummyCoordinates[0]) > calcDistanceBetweenTwoPoints(pointA,dummyCoordinates[1])
  68. ? dummyCoordinates[1]
  69. : dummyCoordinates[0];
  70.  
  71. I do not get the logic
  72. explain 😛
  73. I know you are trying to see which point is nearer
  74. ah I get it now
  75.  
  76. mudit sharma
  77. ,
  78. 3 mins
  79. ,
  80. New
  81. 🙂
  82.  
  83. Shubham Goyal
  84. ,
  85. 2 mins
  86. ,
  87. New
  88. and you refactored code, that is amazing
  89. your tests are trying to test what?
  90.  
  91. Shubham Goyal
  92. ,
  93. 1 min
  94. ,
  95. Edited,
  96. New
  97. There is no test for -
  98. 1. Is the drawn angle actually 90 degrees?
  99. 2. Is the drawn point visible?
  100. 3. Have you drawn the angle in the right direction?
  101. @mudit sharma your tests should test the main contribution of the pull request, in this case, it is these 3 - you can probably add more
  102. reply if you disagree 😛 I can be wrong
  103.  
  104. mudit sharma
  105. ,
  106. Now
  107. ,
  108. New
  109. agreed
  110. 2nd point is tested
  111. not 1 and 3 though
  112.  
  113. Shubham Goyal
  114. ,
  115. Now
  116. ,
  117. New
  118. yes
  119. sorry yeah
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement