Sfoglia il codice sorgente

Modified score computing (softer decrease with time) and added helper scripts

Denis Merigoux 9 anni fa
parent
commit
e98097ccc4
4 ha cambiato i file con 14 aggiunte e 6 eliminazioni
  1. 1 1
      counter/templates/seumEmail.txt
  2. 5 5
      counter/views.py
  3. 1 0
      deploy.sh
  4. 7 0
      fecthLatestDB.sh

+ 1 - 1
counter/templates/seumEmail.txt

@@ -1,5 +1,5 @@
1 1
 {% autoescape off %}{% if selfSeum %}{{name}} a le seum : {{reason}}{% else %}{{who.trigramme}} ({{who.name}}) a foutu le seum à {{name}} : {{reason}}{% endif %}
2 2
 --
3
-SeumBook™ - http://seum.merigoux.ovh
3
+SeumBook™ - https://seum.merigoux.ovh
4 4
 
5 5
 P.S. : Pour ne plus recevoir ces messages, coche le bouton en bas de la page d'acceuil du site{% endautoescape %}

+ 5 - 5
counter/views.py

@@ -57,8 +57,8 @@ def home(request):
57 57
             myCounter.likeCount = likesMe.count()
58 58
             if myCounter.likeCount:
59 59
                 myCounter.likersString = functools.reduce(
60
-                            lambda a,b: a + ", " +  b,
61
-                            [like.liker.trigramme for like in likesMe])
60
+                    lambda a, b: a + ", " + b,
61
+                    [like.liker.trigramme for like in likesMe])
62 62
         myCounter.lastReset.formatted_delta = format_timedelta(
63 63
             myCounter.lastReset.delta, locale='fr', threshold=1)
64 64
     except Counter.DoesNotExist:
@@ -125,9 +125,9 @@ def home(request):
125 125
     # cause that after 1 day the « recentness score drops from 1 to 0.36
126 126
     # The counters with no seum have a like count of -1 by convention
127 127
     counters = sorted(counters, key=lambda t: - (
128
-                      math.log(t.likeCount + 2) *
129
-                      math.exp(-(t.lastReset.delta.total_seconds()) /
130
-                                (24 * 3600))))
128
+                      math.log(t.likeCount + 2) /
129
+                      (1 + (t.lastReset.delta.total_seconds()) /
130
+                       (24 * 3600))))
131 131
 
132 132
     # Column graph
133 133
     if (len(lastResets) == 0):

+ 1 - 0
deploy.sh

@@ -0,0 +1 @@
1
+ssh evezh 'git pull; sudo service apache2 reload'

+ 7 - 0
fecthLatestDB.sh

@@ -0,0 +1,7 @@
1
+cd "$(dirname "$0")"
2
+ssh evezh 'cd seum-counter; source env/bin/activate; python manage.py dumpdata --exclude contenttypes > seum.json'
3
+scp evezh:/home/denis/seum-counter/seum.json seum.json
4
+rm -f db.sqlite3
5
+source env/bin/activate
6
+python manage.py migrate
7
+python manage.py loaddata seum.json