Bläddra i källkod

Remove some dead code.
Sort ingredients alphabetically when creating a new order.

Lee Morgan 5 år sedan
förälder
incheckning
2e2f4f7b24

+ 1 - 5
views/dashboardPage/bundle.js

@@ -390,11 +390,6 @@ class Merchant{
         return this._transactions;
     }
 
-    //TODO: remove this, just for testing purposes
-    clearTransactions(){
-        this._transactions = [];
-    }
-
     getTransactions(from = 0, to = new Date()){
         if(merchant._transactions.length <= 0){
             return [];
@@ -1951,6 +1946,7 @@ let newOrder = {
             ingredientList.removeChild(ingredientList.firstChild);
         }
 
+        merchant.ingredients.sort((a, b) => (a.ingredient.name > b.ingredient.name) ? 1 : -1);
         for(let i = 0; i < merchant.ingredients.length; i++){
             let ingredient = document.createElement("button");
             ingredient.classList = "choosable";

+ 0 - 5
views/dashboardPage/js/classes/Merchant.js

@@ -274,11 +274,6 @@ class Merchant{
         return this._transactions;
     }
 
-    //TODO: remove this, just for testing purposes
-    clearTransactions(){
-        this._transactions = [];
-    }
-
     getTransactions(from = 0, to = new Date()){
         if(merchant._transactions.length <= 0){
             return [];

+ 1 - 0
views/dashboardPage/js/sidebars/newOrder.js

@@ -14,6 +14,7 @@ let newOrder = {
             ingredientList.removeChild(ingredientList.firstChild);
         }
 
+        merchant.ingredients.sort((a, b) => (a.ingredient.name > b.ingredient.name) ? 1 : -1);
         for(let i = 0; i < merchant.ingredients.length; i++){
             let ingredient = document.createElement("button");
             ingredient.classList = "choosable";