forked from rDrama/rDrama
sfd
parent
a956d2a149
commit
3be328de00
|
@ -23,7 +23,7 @@ class CommentAux(Base):
|
|||
ban_reason = Column(String(256), default='')
|
||||
|
||||
|
||||
class Comment(Base, Age_times, Scores, Stndrd, Fuzzing):
|
||||
class Comment(Base, Age_times):
|
||||
|
||||
__tablename__ = "comments"
|
||||
|
||||
|
|
|
@ -15,14 +15,6 @@ class Stndrd:
|
|||
def created_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.created_utc)))
|
||||
|
||||
@property
|
||||
@lazy
|
||||
def created_iso(self):
|
||||
|
||||
t = time.gmtime(self.created_utc)
|
||||
return time.strftime("%Y-%m-%dT%H:%M:%S+00:00", t)
|
||||
|
||||
|
||||
class Age_times:
|
||||
|
||||
@property
|
||||
|
@ -109,51 +101,4 @@ class Age_times:
|
|||
|
||||
@property
|
||||
def edited_datetime(self):
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.edited_utc)))
|
||||
|
||||
class Scores:
|
||||
|
||||
@property
|
||||
def score_percent(self):
|
||||
|
||||
return 101
|
||||
|
||||
@property
|
||||
def score(self):
|
||||
return int(self.score) or 0
|
||||
|
||||
|
||||
class Fuzzing:
|
||||
|
||||
@property
|
||||
def score(self):
|
||||
|
||||
real = self.score
|
||||
real = int(real)
|
||||
if real <= 10:
|
||||
return real
|
||||
|
||||
k = 0.01
|
||||
|
||||
a = math.floor(real * (1 - k))
|
||||
b = math.ceil(real * (1 + k))
|
||||
return random.randint(a, b)
|
||||
|
||||
@property
|
||||
def upvotes(self):
|
||||
|
||||
if self.upvotes <= 10: return self.upvotes
|
||||
|
||||
lower = int(self.upvotes * 0.99)
|
||||
upper = int(self.upvotes * 1.01) + 1
|
||||
|
||||
return random.randint(lower, upper)
|
||||
|
||||
@property
|
||||
def downvotes(self):
|
||||
if self.downvotes <= 10: return self.downvotes
|
||||
|
||||
lower = int(self.downvotes * 0.99)
|
||||
upper = int(self.downvotes * 1.01) + 1
|
||||
|
||||
return random.randint(lower, upper)
|
||||
return str(time.strftime("%d/%B/%Y %H:%M:%S UTC", time.gmtime(self.edited_utc)))
|
|
@ -28,7 +28,7 @@ class SubmissionAux(Base):
|
|||
embed_url = Column(String(256))
|
||||
|
||||
|
||||
class Submission(Base, Stndrd, Age_times, Scores, Fuzzing):
|
||||
class Submission(Base, Age_times):
|
||||
|
||||
__tablename__ = "submissions"
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
|
||||
<meta property="og:article:author" content="{{'@'+p.author.username}}" />
|
||||
<meta property="article:published_time" content="{{p.created_iso}}" />
|
||||
<meta property="article:published_time" content="{{p.created_datetime}}" />
|
||||
{% if p.edited_utc %}<meta property="article:modified_time" content="{{p.edited_string}}" />{% endif %}
|
||||
<meta property="og:description" name="description" content="{{p.realbody(V)}}" />
|
||||
<meta property="og:author" name="author" content="{{'@'+p.author.username}}" />
|
||||
|
|
Loading…
Reference in New Issue