Compare commits

..

No commits in common. "1ce84db59c0900d24804121ca2bc39b62d1921e0" and "6c28df7617c46c9a3b0a4e2d72513ac395197b94" have entirely different histories.

3 changed files with 7 additions and 11 deletions

View File

@ -28,10 +28,8 @@ def create_task(session_id: int):
types = list(filter(lambda item: item in ('parse', 'add', 'message'), info.keys()))
if len(types) <= 0:
return "", 204
type = types[0]
if len(types) > 0:
type = types[0]
task = Task(
name = info.get('task_name') or str(uuid.uuid4()),

View File

@ -3,7 +3,7 @@ import time
from celery import shared_task
import asyncio
from telethon.tl.types import UserStatusOnline, UserStatusOffline, UserStatusRecently
from telethon.tl.types import UserStatusOnline, UserStatusOffline
from app.models.user import User
from paper.parser import PaperParser
@ -55,16 +55,14 @@ def parse_users_task(self, task_id: int):
)
for user in users:
if not user.username or user.bot:
if not user.username and user.bot:
continue
is_active = False
if isinstance(user.status, UserStatusOffline):
was_online = user.status.was_online.replace(tzinfo=datetime.timezone.utc)
today = datetime.datetime.today().replace(tzinfo=datetime.timezone.utc)
is_active = was_online + datetime.timedelta(days=5) >= today
is_active = user.status.was_online + datetime.timedelta(day=5) >= datetime.now()
if isinstance(user.status, UserStatusOnline) or isinstance(user.status, UserStatusRecently):
if isinstance(user.status, UserStatusOnline):
is_active = True
if not is_active:

View File

@ -38,7 +38,7 @@
<section class="tab-pane fade" id="actions-add-section">
<div class="form-floating">
<input type="text" name="add" class="form-control" id="group-to-input"
<input type="text" name="url" name="add" class="form-control" id="group-to-input"
placeholder="Группа для добавлнеия">
<label for="group-to-input">Группа для добавления</label>
</div>