Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): added admin usage to table of admins #795

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danielsoheil
Copy link

No description provided.

@danielsoheil
Copy link
Author

image

@SaintShit
Copy link
Contributor

Hi, that's great, could you please use sqlalchemy's API rather than executing raw query?

@danielsoheil
Copy link
Author

danielsoheil commented Feb 20, 2024

With this database structure it's a little bit complicated, I think it's not worth it.
I can refactor it anyway if you insist.

cli/admin.py Outdated Show resolved Hide resolved
@danielsoheil
Copy link
Author

Hi, that's great, could you please use sqlalchemy's API rather than executing raw query?

done.

app/db/models.py Outdated
Copy link
Collaborator

@M03ED M03ED Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we have duplicate function ? there both do same thing
also we have lifetime_used_traffic function and you can calculate reseted_usage way faster
reseted_usage = lifetime_used_traffic - used_traffic

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's not same, you have a better idea?

lifetime_used_traffic is not faster :/
lifetime_used_traffic will get all data from database and calculate it in python
by reseted_usage that I add, you will get calculated data from database

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are doing same thing twice, you can do less job
Another way to avoid more jobs is that we calculate rested usage then for lifetime_used_traffic sum rested usage with used traffic to calculate lifetime_used_traffic

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can do it yourself.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

من در مورد نحوه محاسبه ریست یوزیج ابن کار رو به صورت دستی انجام میدم
مصرف کل به علاوه مانده حجم که مقدار کامل رو درمیارم
برای مثال
اکانت ۵۰ گیگ دوبار کامل مصرف شده ریست شده و حجم کل ۱۳۰ گیگ هستش
۱۳۰ گیگ به اضافه ۲۰ گیگ مانده از ۵۰ گیگ
عکسی که پیوست کردم رو من حجم رو 1100 حساب میکنم
IMG_20240315_002806_454

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use power instead of Multiplication
usage // (1024 ** 3)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually its better to use from app.utils.system import readable_size function

@danielsoheil
Copy link
Author

I implemented this feature for my self but one of my friends need this. i told her this is going add in official version, when do you think you can work on it?

@danielsoheil danielsoheil reopened this Feb 27, 2024
@danielsoheil
Copy link
Author

guys, i need this
implement it your self or merge this

@realartin
Copy link

guys, i need this implement it your self or merge this

ما هم همینطور بهش نیاز داریم

doaei pushed a commit to doaei/Marzban that referenced this pull request Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants