Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
altlinux-packages-bot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Unitsaev
altlinux-packages-bot
Commits
13f8b8b8
Verified
Commit
13f8b8b8
authored
Jul 12, 2025
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update statistics
parent
d0f90c33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
methods.py
src/api/methods.py
+5
-1
models.py
src/api/models.py
+5
-0
statistics.py
src/handlers/statistics.py
+17
-5
No files found.
src/api/methods.py
View file @
13f8b8b8
...
...
@@ -40,7 +40,11 @@ class APIInfo:
class
PackagesetInfo
:
def
__init__
(
self
,
client
:
BaseAPI
):
self
.
client
=
client
async
def
active_packagesets
(
self
)
->
models
.
PackageSetActivePackageSetsModel
:
data
=
await
self
.
client
.
get
(
"/packageset/active_packagesets"
)
return
models
.
PackageSetActivePackageSetsModel
(
**
data
)
async
def
repository_statistics
(
self
,
branch
:
str
|
None
=
None
)
->
models
.
RepositoryStatisticsModel
:
if
branch
:
data
=
await
self
.
client
.
get
(
"/packageset/repository_statistics"
,
{
"branch"
:
branch
})
...
...
src/api/models.py
View file @
13f8b8b8
...
...
@@ -8,6 +8,11 @@ class APIVersion(BaseModel):
description
:
str
class
PackageSetActivePackageSetsModel
(
BaseModel
):
length
:
int
packagesets
:
List
[
str
]
class
RepositoryStatisticsPackageCountsModel
(
BaseModel
):
arch
:
str
component
:
str
...
...
src/handlers/statistics.py
View file @
13f8b8b8
from
telegrinder
import
MESSAGE_FROM_USER
,
Dispatch
,
Message
,
WaiterMachine
,
CallbackQuery
from
telegrinder.rules
import
Command
,
PayloadEqRule
,
Text
,
IsUser
from
telegrinder.rules
import
Command
,
PayloadEqRule
,
Text
,
IsUser
,
Markup
,
Argument
from
datetime
import
datetime
import
locale
...
...
@@ -13,11 +13,23 @@ from database.models import User
dp
=
Dispatch
()
wm
=
WaiterMachine
(
dp
)
@dp.message
(
Command
(
"statistics"
))
@dp.message
(
Command
(
"statistics"
,
Argument
(
"branch"
,
optional
=
True
)
))
@dp.message
(
Text
([
"statistics"
,
"статистика"
],
ignore_case
=
True
),
IsUser
())
async
def
profile_handler
(
m
:
Message
,
user
:
User
|
None
)
->
None
:
statistics_data
=
(
await
api
.
packageset
.
repository_statistics
(
user
.
default_branch
))
.
branches
[
0
]
async
def
profile_handler
(
m
:
Message
,
user
:
User
|
None
,
branch
:
str
|
None
=
None
)
->
None
:
active_branches
=
(
await
api
.
packageset
.
active_packagesets
())
.
packagesets
if
branch
:
branch
=
branch
.
strip
()
.
lower
()
if
branch
not
in
active_branches
:
await
m
.
answer
(
f
"Репозиторий {branch} не найден"
)
return
else
:
if
user
:
branch
=
user
.
default_branch
else
:
branch
=
(
await
api
.
packageset
.
active_packagesets
())[
0
]
statistics_data
=
(
await
api
.
packageset
.
repository_statistics
(
branch
))
.
branches
[
0
]
locale
.
setlocale
(
locale
.
LC_TIME
,
'ru_RU.UTF-8'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment