is check
This commit is contained in:
parent
d57429d9c6
commit
0cf975820a
|
@ -42,6 +42,7 @@ class TgItem(models.Model):
|
|||
created_at = models.DateTimeField(auto_now_add=True, null=True, blank=True)
|
||||
updated_at = models.DateTimeField(auto_now=True, null=True, blank=True)
|
||||
tmc = models.ManyToManyField(TmcElement)
|
||||
is_check = models.BooleanField()
|
||||
|
||||
def __str__(self):
|
||||
return f"Tg item {self.name}"
|
||||
|
|
|
@ -148,7 +148,7 @@ class TgBot:
|
|||
logger.info(f"Step {current_step} from user {user.full_name} with data {context.chat_data}")
|
||||
|
||||
inv = []
|
||||
async for e in TgItem.objects.filter(user_id=user.id).order_by('-created_at'):
|
||||
async for e in TgItem.objects.filter(user_id=user.id, is_check=False).order_by('-created_at'):
|
||||
inv.append({"name": e.name, "id": str(e.id)})
|
||||
keys = chunk(1, inv)
|
||||
if len(inv) > 0:
|
||||
|
|
|
@ -131,7 +131,7 @@ class TmcStatViewset(viewsets.ViewSet):
|
|||
def list(self, request):
|
||||
if 'type' in request.query_params and request.query_params['type'] == 'location':
|
||||
queryset = (
|
||||
TgItem.objects.all()
|
||||
TgItem.objects.filter(is_check=True)
|
||||
.values("location__parent")
|
||||
.annotate(
|
||||
inv_count=Count("location__parent"),
|
||||
|
|
Loading…
Reference in New Issue