Compare commits

...

10 Commits

Author SHA1 Message Date
Simple_Not
b646c73f47 remake many certs
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-17 12:36:23 +10:00
Simple_Not
2a93b636dc fixxxxx
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-16 15:02:57 +10:00
Simple_Not
2cb35e8015 fixxxxx
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-16 15:01:43 +10:00
Simple_Not
8a322efa6b fixxxxx
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-16 15:00:36 +10:00
Simple_Not
bbc5207cb4 retunk metrics
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-13 19:25:22 +10:00
Simple_Not
a3fbd02692 retunk metrics
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-13 18:26:36 +10:00
Simple_Not
e8bed9a381 retunk metrics 2023-07-13 18:25:01 +10:00
639e5ecc2e Пофиксил метрику
All checks were successful
continuous-integration/drone/push Build is passing
2023-06-22 17:37:13 +10:00
Simple_Not
8d684856c9 more metrics
All checks were successful
continuous-integration/drone/push Build is passing
2023-06-21 12:33:09 +10:00
Simple_Not
ae21a176f7 more metrics 2023-06-21 12:30:26 +10:00
4 changed files with 43 additions and 42 deletions

View File

@@ -18,8 +18,8 @@ steps:
- name: pull into the folduh
commands:
- cd /usr/share/$DRONE_REPO_NAME
- git pull
- chown -R jack:jack .
- su -c "git pull" jack
#- chown -R jack:jack .
when:
branch:
- BIG_DICK_COCK

View File

@@ -1 +0,0 @@
Оно собирает хуи!

View File

@@ -1,32 +1,13 @@
from sqlalchemy import create_engine, Integer, String, BIGINT, Column, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy import select, update
from flask import Flask
#### https://docs.python-arango.com/en/main/
from arango import ArangoClient
app = Flask(__name__)
engine = create_engine('postgresql+psycopg2://postgres:postgres@postgres.vdk2ch.ru:5432/jack_bot', echo=True)
Session = sessionmaker(bind=engine)
Base = declarative_base()
class user(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
user_id = Column(Integer)
user_fullname = Column(String)
dick_size = (Column(Integer))
datetimes = (Column(DateTime))
chat_id = Column(BIGINT)
@@ -34,14 +15,24 @@ class user(Base):
def get_top_dicks():
session = Session()
arango_client = ArangoClient(hosts='https://arango.guaranteedstruggle.host')
pipisa_db = arango_client.db('pipisa', username='root', password='stolendick527')
dicks_collection = pipisa_db.collection('dicks')
top = session.query(user.user_fullname, user.dick_size, user.user_id, user.chat_id).order_by(user.dick_size.desc()).all()
dicks = dicks_collection.all( )
dicks = [[
d['user_fullname'],
d['dick_size'],
d['user_id'],
d['chat_id'],
d['attempts'],
] for d in dicks]
dicks = sorted(dicks, key=lambda dick: dick[1], reverse=True)
return dicks
session.close()
return top
@app.route('/metrics')
@@ -54,6 +45,13 @@ def metrics():
for dick in docks:
metrics += 'pipisio{user="%s", user_id="%s", chat_id="%s"} %s\n' % (dick[0], dick[2], dick[3], dick[1])
# текущее число попыток
for dick in docks:
metrics += 'pipisio_attempto{user="%s", user_id="%s", chat_id="%s"} %s\n' % (dick[0], dick[2], dick[3], dick[4])
docks = [ d for d in docks if d[3] == -1001355646177]
# расстояние до следующего впереди
for k in range(len(docks)):
@@ -69,13 +67,11 @@ def metrics():
i -= 1
upper_dick_size = docks[i][1]
if i == 0:
metrics += 'pipisio_topdick_distanso{user="%s", user_id="%s", chat_id="%s"} %s\n' % (docks[k][0], docks[k][2], docks[k][3], 0)
else:
metrics += 'pipisio_topdick_distanso{user="%s", user_id="%s", chat_id="%s"} %s\n' % (docks[k][0], docks[k][2], docks[k][3], (upper_dick_size - docks[k][1]))
metrics += 'pipisio_topdick_distanso{user="%s", user_id="%s", chat_id="%s"} %s\n' % (docks[k][0], docks[k][2], docks[k][3], (upper_dick_size - docks[k][1]))
return metrics
if __name__ == '__main__':
app.run(host='0.0.0.0', port=9992)
engine.dispose()

6
requirements.txt Normal file
View File

@@ -0,0 +1,6 @@
aiogram
sqdb
sqlalchemy
graypy
flask
psycopg2