diff --git a/back/api/migrations/0001_initial.py b/back/api/migrations/0001_initial.py
deleted file mode 100644
index 1dc2830..0000000
--- a/back/api/migrations/0001_initial.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-26 10:33
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- initial = True
-
- dependencies = [
- ]
-
- operations = [
- migrations.CreateModel(
- name='Task',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('title', models.CharField(max_length=100)),
- ],
- ),
- ]
diff --git a/back/api/migrations/0002_rename_task_product.py b/back/api/migrations/0002_rename_task_product.py
deleted file mode 100644
index 31c1020..0000000
--- a/back/api/migrations/0002_rename_task_product.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-26 11:26
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('api', '0001_initial'),
- ]
-
- operations = [
- migrations.RenameModel(
- old_name='Task',
- new_name='Product',
- ),
- ]
diff --git a/back/api/migrations/0003_product_model3d.py b/back/api/migrations/0003_product_model3d.py
deleted file mode 100644
index a6f5732..0000000
--- a/back/api/migrations/0003_product_model3d.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-26 12:45
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('api', '0002_rename_task_product'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='product',
- name='model3d',
- field=models.FileField(default=None, null=True, upload_to=''),
- ),
- ]
diff --git a/back/api/migrations/0004_product_description.py b/back/api/migrations/0004_product_description.py
deleted file mode 100644
index 4b755d0..0000000
--- a/back/api/migrations/0004_product_description.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-26 12:57
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('api', '0003_product_model3d'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='product',
- name='description',
- field=models.TextField(default=None, null=True),
- ),
- ]
diff --git a/back/api/migrations/0005_product_image1_alter_product_model3d.py b/back/api/migrations/0005_product_image1_alter_product_model3d.py
deleted file mode 100644
index c37929e..0000000
--- a/back/api/migrations/0005_product_image1_alter_product_model3d.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-27 06:33
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('api', '0004_product_description'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='product',
- name='image1',
- field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
- ),
- migrations.AlterField(
- model_name='product',
- name='model3d',
- field=models.FileField(blank=True, default=None, null=True, upload_to='back/files'),
- ),
- ]
diff --git a/back/api/migrations/0006_product_image2_product_image3.py b/back/api/migrations/0006_product_image2_product_image3.py
deleted file mode 100644
index 9cdba28..0000000
--- a/back/api/migrations/0006_product_image2_product_image3.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# Generated by Django 5.0.4 on 2024-04-27 06:35
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('api', '0005_product_image1_alter_product_model3d'),
- ]
-
- operations = [
- migrations.AddField(
- model_name='product',
- name='image2',
- field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
- ),
- migrations.AddField(
- model_name='product',
- name='image3',
- field=models.ImageField(blank=True, default=None, null=True, upload_to='back/files'),
- ),
- ]
diff --git a/front/src/components/Floorplan.vue b/front/src/components/Floorplan.vue
index 6572887..fa7e694 100644
--- a/front/src/components/Floorplan.vue
+++ b/front/src/components/Floorplan.vue
@@ -87,6 +87,7 @@ onMounted(async () => {
-
+
+
\ No newline at end of file
diff --git a/front/src/helpers.ts b/front/src/helpers.ts
index 777aa26..19cb7da 100644
--- a/front/src/helpers.ts
+++ b/front/src/helpers.ts
@@ -24,4 +24,9 @@ export const random_сolor = () => {
const r = () => Math.floor(200 * Math.random());
return `rgb(${r()}, ${r()}, ${r()})`;
+}
+export function* chunks(arr: T[], n: number): Generator {
+ for (let i = 0; i < arr.length; i += n) {
+ yield arr.slice(i, i + n);
+ }
}
\ No newline at end of file
diff --git a/front/src/stores/floorplan.ts b/front/src/stores/floorplan.ts
index eae29f3..1511ee0 100644
--- a/front/src/stores/floorplan.ts
+++ b/front/src/stores/floorplan.ts
@@ -1,11 +1,13 @@
import { defineStore } from 'pinia'
import { SERVER_URL } from '../constants'
+import { chunks } from '../helpers'
export const useFloorplanStore = defineStore('floorplan', {
state: () => {
return {
title: undefined,
- np_array: [] as number[][]
+ np_array: [] as number[][],
+ prepared_array: [] as number[][]
}
},
actions: {
@@ -15,6 +17,17 @@ export const useFloorplanStore = defineStore('floorplan', {
const data = await res.json()
this.title = data.title
this.np_array = data.np_field
+ const chunkSize = 5
+ this.prepared_array = [...chunks(data.np_field, chunkSize)].map(line => {
+ const line_data = [] as any[][]
+ line.map((item: any) => [...chunks(item, chunkSize)]).map((item) => {
+ item.map((one_line, k) => {
+ if (!line_data[k]) line_data[k] = []
+ line_data[k].push(...one_line)
+ })
+ })
+ return line_data.map(el=> el.some(deep => deep > 0) ? 1 : 0)
+ });
} catch (error) {
// this.list = []
}