diff --git a/back/tgbot/tgbot.py b/back/tgbot/tgbot.py
index a8a62ce..8a688d5 100644
--- a/back/tgbot/tgbot.py
+++ b/back/tgbot/tgbot.py
@@ -69,7 +69,7 @@ class TgBot:
text = await TgBot.app.bot.get_file(item.text)
TgBotUpdater.return_values[item.text] = text.file_path
except Exception as e:
- TgBotUpdater.return_values[item.text] = 'error'
+ TgBotUpdater.return_values[item.text] = None
async def set_handlers(self):
TgBot.app.add_handler(
@@ -187,7 +187,7 @@ class TgBot:
f"Step {current_step} from user {user.full_name} in {update.message}"
)
- if not current_step and update.message.text == "/inv":
+ if update.effective_message.text == "/inv":
context.chat_data["step"] = "name"
await update.effective_message.reply_markdown_v2(
(
@@ -311,7 +311,6 @@ class TgBot:
await element.asave()
empty_fields = await tmc_element.field.filter(text=None).acount()
- logger.info(empty_fields)
if empty_fields > 0:
context.chat_data["step"] = "add_tmc"
await self.inv(update, context)
diff --git a/front/assets/main.scss b/front/assets/main.scss
index 0571e86..45694b7 100644
--- a/front/assets/main.scss
+++ b/front/assets/main.scss
@@ -49,7 +49,7 @@
dd {
@apply col-span-full col-start-2;
&:last-of-type {
- @apply mb-2
+ @apply mb-2
}
}
diff --git a/front/pages/table/index.vue b/front/pages/table/index.vue
index 2176920..8827df0 100644
--- a/front/pages/table/index.vue
+++ b/front/pages/table/index.vue
@@ -30,7 +30,7 @@ const columns = [
Проведенные инвентаризации
-
+
Создано: {{ new Date(row.created_at).toLocaleString('ru-RU') }}
Обновлено: {{ new Date(row.updated_at).toLocaleString('ru-RU') }}
@@ -54,8 +54,4 @@ const columns = [
table {
max-width: 100%;
}
-
-li {
- white-space: normal;
-}
\ No newline at end of file
diff --git a/front/store/authors.ts b/front/store/authors.ts
new file mode 100644
index 0000000..a4f9cc7
--- /dev/null
+++ b/front/store/authors.ts
@@ -0,0 +1,44 @@
+interface imagesList {
+ [key: string]: {
+ status: 'idle' | 'pending' | 'success' | 'error',
+ result?: string
+ }
+}
+export const useImagesStore = defineStore('images', {
+ state: () => ({ list: {} as imagesList }),
+ actions: {
+ getImage(name: string) {
+ if (!this.list[name]) {
+ this.list[name] = {
+ status: 'idle',
+ // result: 'https://media.istockphoto.com/id/1490517357/photo/scientists-are-researching-and-analyzing-harmful-contaminants-in-the-laboratory.webp?s=170667a&w=0&k=20&c=Fh4t-P_b-a1QxwyBUzUa0AuLp8FLNyLy4hl4HUm82Ao='
+ }
+ }
+ if (
+ !Object.entries(this.list).filter(el => el[1].status == 'pending').length &&
+ Object.entries(this.list).filter(el => el[1].status == 'idle').length) {
+ this.loadImages()
+ }
+ return this.list[name]
+ },
+ async loadOneImage(name: string) {
+ const file_url_data = await apiCall(`tgbot/items/get_image/${name}/`)
+ if (file_url_data.length > 0 && file_url_data[0] !== null) {
+ this.list[name].status = 'success'
+ this.list[name].result = file_url_data[0]
+ } else {
+ this.list[name].status = 'error'
+ }
+ if (Object.entries(this.list).filter(el => el[1].status == 'idle').length) {
+ this.loadImages()
+ }
+ },
+ loadImages() {
+ const elements = Object.entries(this.list).filter(el => el[1].status == 'idle')
+ elements.slice(0, 2).map(el => {
+ this.list[el[0]].status = 'pending'
+ this.loadOneImage(el[0])
+ })
+ }
+ },
+})
\ No newline at end of file
diff --git a/front/store/images.ts b/front/store/images.ts
index 27ab451..ebe9fe5 100644
--- a/front/store/images.ts
+++ b/front/store/images.ts
@@ -14,17 +14,15 @@ export const useImagesStore = defineStore('images', {
// result: 'https://media.istockphoto.com/id/1490517357/photo/scientists-are-researching-and-analyzing-harmful-contaminants-in-the-laboratory.webp?s=170667a&w=0&k=20&c=Fh4t-P_b-a1QxwyBUzUa0AuLp8FLNyLy4hl4HUm82Ao='
}
}
- if (
- !Object.entries(this.list).filter(el => el[1].status == 'pending').length &&
- Object.entries(this.list).filter(el => el[1].status == 'idle').length) {
+ if (!Object.values(this.list).filter(el => el.status == 'pending').length) {
this.loadImages()
}
return this.list[name]
},
async loadOneImage(name: string) {
const file_url_data = await apiCall(`tgbot/items/get_image/${name}/`)
-
- if (file_url_data.length > 0 && file_url_data[0] !== 'error') {
+
+ if (file_url_data.length > 0 && file_url_data[0] !== null) {
this.list[name].status = 'success'
this.list[name].result = file_url_data[0]
} else {