From 9ba0214fbf9a20a75a560c3d0e094ecae0a28b3a Mon Sep 17 00:00:00 2001 From: Benjamin F Date: Mon, 5 Dec 2022 06:51:47 -0800 Subject: [PATCH] fix(breanna): Eliminate warning messages when there is no secondary dart --- designs/breanna/src/dart-utils.mjs | 52 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/designs/breanna/src/dart-utils.mjs b/designs/breanna/src/dart-utils.mjs index 706f50df87b..0132a84671e 100644 --- a/designs/breanna/src/dart-utils.mjs +++ b/designs/breanna/src/dart-utils.mjs @@ -84,27 +84,39 @@ export function getDartLocationsAsNumbers(options) { else return [loc1, loc2] } -export const getDartPaths = (Path, points) => [ - new Path() - .line(points.primaryBustDart1) - .line(points.primaryBustDartTip) - .line(points.primaryBustDart2), - new Path() - .line(points.secondaryBustDart1) - .line(points.secondaryBustDartTip) - .line(points.secondaryBustDart2), -] +export const getDartPaths = (Path, points) => { + let dart_paths = [ + new Path() + .line(points.primaryBustDart1) + .line(points.primaryBustDartTip) + .line(points.primaryBustDart2), + ] + if ('secondaryBustDart1' in points) + dart_paths.push( + new Path() + .line(points.secondaryBustDart1) + .line(points.secondaryBustDartTip) + .line(points.secondaryBustDart2) + ) + return dart_paths +} -export const getSaDartPaths = (Path, points) => [ - new Path() - .line(points.primaryBustDart1) - .line(points.primaryBustDartEdge) - .line(points.primaryBustDart2), - new Path() - .line(points.secondaryBustDart1) - .line(points.secondaryBustDartEdge) - .line(points.secondaryBustDart2), -] +export const getSaDartPaths = (Path, points) => { + let dart_paths = [ + new Path() + .line(points.primaryBustDart1) + .line(points.primaryBustDartEdge) + .line(points.primaryBustDart2), + ] + if ('secondaryBustDart1' in points) + dart_paths.push( + new Path() + .line(points.secondaryBustDart1) + .line(points.secondaryBustDartEdge) + .line(points.secondaryBustDart2) + ) + return dart_paths +} /* * Once the front is constructed with the theorethical bust darts, we