~sircmpwn/hnstats

9a90618da0e2eeff42bbc2f830873af9bf4d1549 — Drew DeVault 6 years ago 3e1a404
Revert "Add cleaned status to pages"

This reverts commit 3e1a40450c319c3d147cacd8f83acaf0902e6fd3.
3 files changed, 1 insertions(+), 13 deletions(-)

M clean.py
M templates/article.html
M update.py
M clean.py => clean.py +1 -3
@@ 17,16 17,14 @@ for article in articles:
        continue
    samples = (ArticleSample.query
        .filter(ArticleSample.article_id == article.id)
        .filter(ArticleSample.rank > 30)
        .filter(ArticleSample.sample_time < cutoff))
    print("Deleting {} samples for article {}".format(
        samples.count(), article.id))
    samples.delete()
    article.cleaned = True

# Delete all samples >90 days
cutoff = datetime.utcnow() - timedelta(days=90)
records = ArticleSample.query\
    .filter(ArticleSample.sample_time < cutoff)\
    .delete()

db.commit()

M templates/article.html => templates/article.html +0 -6
@@ 84,12 84,6 @@
<noscript>
  <p>We would render some graphs here, but you have JavaScript disabled.</p>
</noscript>
{% if article.cleaned %}
<div class="alert alert-warning">
  Due to this article's age, some samples have been cleaned from the database.
  Any samples from when the article was not on the front page are missing.
</div>
{% endif %}
<div class="row charts">
  <div class="col-md-6">
    <h4>Rank over time</h4>

M update.py => update.py +0 -4
@@ 90,10 90,6 @@ class Article(db.Base):
    comments = sa.Column(sa.Integer,
            nullable=False)

    cleaned = sa.Column(sa.Boolean,
            nullable=False,
            default=False)

class ArticleSample(db.Base):
    __tablename__ = "article_samples"
    id = sa.Column(sa.Integer,