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,9 +28,7 @@ def create_task(session_id: int):
types = list(filter(lambda item: item in ('parse', 'add', 'message'), info.keys())) types = list(filter(lambda item: item in ('parse', 'add', 'message'), info.keys()))
if len(types) <= 0: if len(types) > 0:
return "", 204
type = types[0] type = types[0]
task = Task( task = Task(

View File

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

View File

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