mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
bugfix
This commit is contained in:
parent
7fc0302376
commit
28db316e77
3 changed files with 43 additions and 1 deletions
|
@ -876,7 +876,7 @@ class PostReplyVote(db.Model):
|
|||
class ActivityPubLog(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
direction = db.Column(db.String(3)) # 'in' or 'out'
|
||||
activity_id = db.Column(db.String(100), index=True)
|
||||
activity_id = db.Column(db.String(256), index=True)
|
||||
activity_type = db.Column(db.String(50)) # e.g. 'Follow', 'Accept', 'Like', etc
|
||||
activity_json = db.Column(db.Text) # the full json of the activity
|
||||
result = db.Column(db.String(10)) # 'success' or 'failure'
|
||||
|
|
|
@ -609,6 +609,10 @@ def _confidence(ups, downs):
|
|||
|
||||
|
||||
def confidence(ups, downs) -> float:
|
||||
if ups is None:
|
||||
ups = 0
|
||||
if downs is None:
|
||||
downs = 0
|
||||
if ups + downs == 0:
|
||||
return 0.0
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
"""increase activity id length
|
||||
|
||||
Revision ID: 6b4774eb6349
|
||||
Revises: b86c49cbd9a0
|
||||
Create Date: 2024-01-19 07:45:25.845475
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '6b4774eb6349'
|
||||
down_revision = 'b86c49cbd9a0'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('activity_pub_log', schema=None) as batch_op:
|
||||
batch_op.alter_column('activity_id',
|
||||
existing_type=sa.VARCHAR(length=100),
|
||||
type_=sa.String(length=256),
|
||||
existing_nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('activity_pub_log', schema=None) as batch_op:
|
||||
batch_op.alter_column('activity_id',
|
||||
existing_type=sa.String(length=256),
|
||||
type_=sa.VARCHAR(length=100),
|
||||
existing_nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue