From 91900c3e4bb7b10040af7239640667446b668f4f Mon Sep 17 00:00:00 2001 From: Robert Date: Tue, 30 Apr 2019 13:14:52 -0400 Subject: [PATCH] update Ben comments --- frontend/src/components/Csv_Formatter.vue | 9 +++++---- frontend/src/components/Map.vue | 13 ++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Csv_Formatter.vue b/frontend/src/components/Csv_Formatter.vue index 97c1727..c0a9005 100644 --- a/frontend/src/components/Csv_Formatter.vue +++ b/frontend/src/components/Csv_Formatter.vue @@ -23,10 +23,11 @@ export default { } }, methods: { - //Create a single csv file with mutliple tables. This is technically not - //possible to do normally, so simply add rows to a single giant table that - //are either empty (to act like spacers), and have header information - //to signify start of new "table" + /* + CSV file format does not support writing to multiple + tabs (like a spredsheet can), for this reason one large + csv file is created with added rows as spacers. + */ generateCsv(data, refinery_location) { var csv_index = 0; diff --git a/frontend/src/components/Map.vue b/frontend/src/components/Map.vue index dac9bff..7252118 100644 --- a/frontend/src/components/Map.vue +++ b/frontend/src/components/Map.vue @@ -250,11 +250,14 @@ export default { //Submit locations to background for optimization submitLocations() { - //This removes all the elements in the map that were deleted (became null) - //The array has to act like this because if we simply remove elements - //during deletion on the map, then all the references to each point will - //be off by 1 element. Instead, we make that element null when removed, - //and when we send to the backend, we create new arrays without the null elements. + /* + Because the backend code relies on the position of elements + added to the coordinate arrays, we cannot simply delete + entries because this would mess up the order. Therefore, + we instead null the item that was deleted before submission + and then use this function to remove the null entries at + the end to maintain proper ordering. + */ var filteredFarm = this.farms.filter(function (el) { return el != null; });