From c3ca61f82d4dcd0bda346cad2d20984315861d7c Mon Sep 17 00:00:00 2001 From: Renzo <6025850@mborijnland.nl> Date: Wed, 13 Mar 2024 10:34:50 +0100 Subject: [PATCH] plantenClass OOP werkt volledig met sample data --- mqtt/__pycache__/mqtt_client.cpython-312.pyc | Bin 0 -> 915 bytes src/js/planten.class.js | 17 +++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 mqtt/__pycache__/mqtt_client.cpython-312.pyc diff --git a/mqtt/__pycache__/mqtt_client.cpython-312.pyc b/mqtt/__pycache__/mqtt_client.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..be6ca40e9e5f7382d9186bf5605263deb8c6ee81 GIT binary patch literal 915 zcmYjP&r1|h9RI%gvCgjUwpv1B;gDX&B~R5MB#^`YzL62R{X_tM3!_U? zqI4!u*#QeI(g25;5&=gl69SfEN!z3>TkA76H!t!)ud7gq04wW9N7-|I3=cf zw}01xGJyRg{!$G{pjLZ1frOUm6H%bn(_Q^S26CWSWIxFw5U5YVkV+@hm}01*;ym~L zFm=CSQ`ZkO%&nTtb*UNa4)wg+3Jv=br;!TNW|UgBE#8MMxP~lDEpfI+d8jlQ$8K?o zm%@-9(fPc2xAM%R+^cZvZn4T^m(Fr~gX%YRXNf(r>u#gwT9uiHGkURDDKcgiYuuu4 zMXVRGYTR_H*$T5Jr!}7@9)1bOi0gT`k+tDCJNRz#?c(mp*X($E?&#``_S~T|+?BtS z%$w4y()&BRw>}OXDicTjgY8EhECjO$0vZaQ2%s`5JCH^Y>i@^lD`-C!K%fQV;P-%; z0G=b@_aH|Al4=4An7aut&XK@uz4AFTGd6@D18uzQBo)4p=U&IT@+Hfk#YT-!B z{m@3gXrte>>wk~?ul)g{7LK*-LC*NDO`ghVoqGeA|2lseK3tiU_sFDdNMX9c%vxiW zdA_}f9{|5lzFAvkQv#@|7$Yw39W4}L6OG>ko)=!R+qpLFFl)U*@9_~d#nPTw5r-1; T6UGi;tfQpJP$#dDLR9t-V*=7( literal 0 HcmV?d00001 diff --git a/src/js/planten.class.js b/src/js/planten.class.js index 3262ea5..fd13610 100644 --- a/src/js/planten.class.js +++ b/src/js/planten.class.js @@ -36,7 +36,7 @@ class PlantGrid { "id": 3, "plantNaam": "Appel", "plantensoort": "Groente", - "plantGeteelt": 1 + "plantGeteelt": 0 }, { "id": 4, @@ -60,7 +60,7 @@ class PlantGrid { "id": 7, "plantNaam": "Groene", "plantensoort": "Groente", - "plantGeteelt": 1 + "plantGeteelt": 0 }, { "id": 8, @@ -72,19 +72,20 @@ class PlantGrid { "id": 9, "plantNaam": "yippie", "plantensoort": "Groente", - "plantGeteelt": 0 + "plantGeteelt": 1 } ]; const filteredData = dataHardObject.filter(plantObject => plantObject.plantGeteelt === 1); // Populate the grid with plant objects - filteredData.forEach((plantObject, index) => { + filteredData.slice(0, 8).forEach((plantObject, index) => { const plant = new Plant(plantObject); - const col = index % this.cols; - const row = Math.floor(index / this.cols); - this.grid[row][col] = plant; + const col = index % this.cols; + const row = Math.floor(index / this.cols); + this.grid[row][col] = plant; }); + // Display the grid in the HTML table with id "planten" this.displayGrid(); @@ -113,7 +114,7 @@ class PlantGrid { td.appendChild(article); itemCount++; - } if (rowIndex === this.rows -1 && colIndex === this.cols -1 & itemCount <= 7) { + } else if (rowIndex === this.rows -1 && colIndex === this.cols -1 & itemCount <= 7) { // Handle the "Add" button const article = document.createElement("article"); const img = article.appendChild(document.createElement("img"));