Removed percentfieldlost field in results.csv
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 9 Jun 2012 12:44:34 +0000 (12:44 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sat, 9 Jun 2012 12:44:34 +0000 (12:44 +0000)
members.py

index 183844c5595634ae3c6d6151f37012311fabb061..2059153e4e91c607d52434d890e374b62bc75505 100755 (executable)
@@ -19,27 +19,27 @@ import htmlentities
 
 """
 csv file format:
-DateTime,Action,Nick1,Grade1,OldField1,NewField1,Nick2,Grade2,OldField2,NewField2,FloodField,FieldLossPercent,Text
+DateTime,Action,Nick1,Grade1,OldField1,NewField1,Nick2,Grade2,OldField2,NewField2,FloodField,Text
 Action is one of: JOIN, QUIT, WIN, LOSS, FLOOD, NOOP, ACT, ANTHILL, TECHNO, GRADE
 
 Exemples:
-NOOP,,,,,,,,,,,Pas de changement dans le TdC
-JOIN,Nirgal,Recrue,0,571628,,,,,,,Nirgal a rejoint l'alliance avec 571 628 cm² 
-QUIT,oncleblu,Chasseur,9940181,0,,,,,,,oncleblu a quité l'alliance avec 9 940 181 cm² 
-WIN,Nirgal,Chasseur,200000,257900,,,,,,,Nirgal a gagné 57 900 cm² 
-LOSS,Nirgal,Passeur 806,553624,442900,,,,,110724,20.00,Nirgal a perdu 110 724 cm² (20.00%) 
-FLOOD,filoux,Passeur 003,55813865,74225093,yosemite,Passeur 004,51142304,32731076,18411228,36.00,filoux a pris 18 411 228 cm² à yosemite (36.00%)
-FLOOD,Nick1,Grade1,100,102,Nick2,Grade2,100,99,1,1.00,Nick1 a pris 1 cm² à Nick2 (1.00%)
-FLOOD,Nick1,Grade1,100,102,Nick3,Grade3,100,99,1,1.00,Nick1 a pris 1 cm² à Nick3 (1.00%)
+NOOP,,,,,,,,,,Pas de changement dans le TdC
+JOIN,Nirgal,Recrue,0,571628,,,,,,Nirgal a rejoint l'alliance avec 571 628 cm² 
+QUIT,oncleblu,Chasseur,9940181,0,,,,,,oncleblu a quité l'alliance avec 9 940 181 cm² 
+WIN,Nirgal,Chasseur,200000,257900,,,,,,Nirgal a gagné 57 900 cm² 
+LOSS,Nirgal,Passeur 806,553624,442900,,,,,110724,Nirgal a perdu 110 724 cm² (20.00%) 
+FLOOD,filoux,Passeur 003,55813865,74225093,yosemite,Passeur 004,51142304,32731076,18411228,filoux a pris 18 411 228 cm² à yosemite (36.00%)
+FLOOD,Nick1,Grade1,100,102,Nick2,Grade2,100,99,1,Nick1 a pris 1 cm² à Nick2 (1.00%)
+FLOOD,Nick1,Grade1,100,102,Nick3,Grade3,100,99,1,Nick1 a pris 1 cm² à Nick3 (1.00%)
 
-ACT,Nick1,Grade1,Actif,En vacances,,,,,,,Nick1 est maintenant en vacances
-COLON,Nick1,Grade1,False,True,,,,,,,Nick1 s'est fait colonisé
-COLON,Nick1,Grade1,True,False,,,,,,,Nick1 n'est plus colonisé
+ACT,Nick1,Grade1,Actif,En vacances,,,,,,Nick1 est maintenant en vacances
+COLON,Nick1,Grade1,False,True,,,,,,Nick1 s'est fait colonisé
+COLON,Nick1,Grade1,True,False,,,,,,Nick1 n'est plus colonisé
 
-ANTHILL,Nick1,Grade1,199,200,,,,,,,La fourmilière de Nick1 a atteint le niveau 200
-TECHNO,Nick1,Grade1,199,200,,,,,,,La technologie Nick1 a atteint le niveau 200
+ANTHILL,Nick1,Grade1,199,200,,,,,,La fourmilière de Nick1 a atteint le niveau 200
+TECHNO,Nick1,Grade1,199,200,,,,,,La technologie Nick1 a atteint le niveau 200
 
-GRADE,Nick1,Recrue,Recrue,Passer 806,,,,,,,Nick1 est maintenant Passeur 806
+GRADE,Nick1,Recrue,Recrue,Passer 806,,,,,,Nick1 est maintenant Passeur 806
 
 Note that in last 2 FLOOD lines exemple, NewField1 is 102 that is different from 100+1 because of multiple floods.
 """
@@ -275,7 +275,7 @@ def field_compare(oldmembers, newmembers, csvfile):
     #print
 
     if not len(changes):
-        publish_line(csvfile, 'NOOP,,,,,,,,,,,No changes')
+        publish_line(csvfile, 'NOOP,,,,,,,,,,No changes')
  
     for nick in changes.keys():
         delta = changes[nick]['delta']
@@ -288,7 +288,7 @@ def field_compare(oldmembers, newmembers, csvfile):
                 continue # not the good one
             percent = float(oldfield[nick2] - newfield[nick2]) / oldfield[nick2] * 100.
             publish_line(csvfile, 
-                'FLOOD,{nick1},{grade1},{oldfield1},{newfield1},{nick2},{grade2},{oldfield2},{newfield2},{deltafield},{percent},{nick1} a pris {nicedeltafield} cm² à {nick2} ({percent:.2f}%)',
+                'FLOOD,{nick1},{grade1},{oldfield1},{newfield1},{nick2},{grade2},{oldfield2},{newfield2},{deltafield},{nick1} a pris {nicedeltafield} cm² à {nick2} ({percent:.2f}%)',
                 nick1=nick,
                 grade1=newmembers[nick].get('grade', ''),
                 oldfield1=oldfield[nick],
@@ -310,7 +310,7 @@ def field_compare(oldmembers, newmembers, csvfile):
             if nick in newfield:
                 percent = float(-delta) / oldfield[nick] * 100.
                 publish_line(csvfile, 
-                    'LOSS,{nick1},{grade1},{oldfield1},{newfield1},,,,,{deltafield},{percent},{nick1} a perdu {nicedeltafield} cm² ({percent:.2f}%)',
+                    'LOSS,{nick1},{grade1},{oldfield1},{newfield1},,,,,{deltafield},{nick1} a perdu {nicedeltafield} cm² ({percent:.2f}%)',
                     nick1=nick,
                     grade1=newmembers[nick].get('grade', ''),
                     oldfield1=oldfield[nick],
@@ -321,7 +321,7 @@ def field_compare(oldmembers, newmembers, csvfile):
                     )
             else:
                 publish_line(csvfile, 
-                    'QUIT,{nick1},{grade1},{oldfield1},0,,,,,{deltafield},,{nick1} a quité l\'alliance avec {nicedeltafield} cm²',
+                    'QUIT,{nick1},{grade1},{oldfield1},0,,,,,{deltafield},{nick1} a quité l\'alliance avec {nicedeltafield} cm²',
                     nick1=nick,
                     grade1=oldmembers[nick].get('grade', ''),
                     oldfield1=oldfield[nick],
@@ -331,7 +331,7 @@ def field_compare(oldmembers, newmembers, csvfile):
         elif delta > 0:
             if nick in oldfield:
                 publish_line(csvfile, 
-                    'WIN,{nick1},{grade1},{oldfield1},{newfield1},,,,,{deltafield},,{nick1} a gagné {nicedeltafield} cm²',
+                    'WIN,{nick1},{grade1},{oldfield1},{newfield1},,,,,{deltafield},{nick1} a gagné {nicedeltafield} cm²',
                     nick1=nick,
                     grade1=newmembers[nick].get('grade', ''),
                     oldfield1=oldfield[nick],
@@ -341,7 +341,7 @@ def field_compare(oldmembers, newmembers, csvfile):
                     )
             else:
                 publish_line(csvfile, 
-                    'JOIN,{nick1},{grade1},0,{newfield1},,,,,{deltafield},,{nick1} a rejoint l\'alliance avec {nicedeltafield} cm²',
+                    'JOIN,{nick1},{grade1},0,{newfield1},,,,,{deltafield},{nick1} a rejoint l\'alliance avec {nicedeltafield} cm²',
                     nick1=nick,
                     grade1=newmembers[nick].get('grade', ''),
                     newfield1=newfield[nick],
@@ -355,7 +355,7 @@ def activity_compare(oldmembers, newmembers, csvfile):
         olda = oldmembers.get(nick, {}).get('active', None)
         if newa and olda and newa != olda:
             publish_line(csvfile, 
-                'ACT,{nick1},{grade1},{olddata1},{newdata1},,,,,,,{nick1} est maintenant {lowernewdata1}',
+                'ACT,{nick1},{grade1},{olddata1},{newdata1},,,,,,{nick1} est maintenant {lowernewdata1}',
                 nick1=nick,
                 grade1=newmembers[nick]['grade'],
                 olddata1=olda,
@@ -369,7 +369,7 @@ def grade_compare(oldmembers, newmembers, csvfile):
         olddata = oldmembers.get(nick, {}).get('grade', None)
         if newdata is not None and olddata is not None and newdata != olddata:
             publish_line(csvfile, 
-                'GRADE,{nick1},{grade1},{olddata1},{newdata1},,,,,,,{nick1} est désormais {grade1}',
+                'GRADE,{nick1},{grade1},{olddata1},{newdata1},,,,,,{nick1} est désormais {grade1}',
                 nick1=nick,
                 grade1=newmembers[nick]['grade'],
                 olddata1=olddata,
@@ -386,7 +386,7 @@ def colonized_compare(oldmembers, newmembers, csvfile):
             else:
                 txt = "n'est plus colonisé"
             publish_line(csvfile, 
-                'COLON,{nick1},{grade1},{olddata1},{newdata1},,,,,,,{nick1} {txt}',
+                'COLON,{nick1},{grade1},{olddata1},{newdata1},,,,,,{nick1} {txt}',
                 nick1=nick,
                 grade1=newmembers[nick]['grade'],
                 olddata1=str(oldc),
@@ -400,7 +400,7 @@ def evolution_compare(oldmembers, newmembers, csvfile):
         olddata = oldmembers.get(nick, {}).get('anthill', None)
         if newdata is not None and olddata is not None and newdata != olddata:
             publish_line(csvfile, 
-                'ANTHILL,{nick1},{grade1},{olddata1},{newdata1},,,,,,,La fourmilière de {nick1} a atteint le niveau {newdata1}',
+                'ANTHILL,{nick1},{grade1},{olddata1},{newdata1},,,,,,La fourmilière de {nick1} a atteint le niveau {newdata1}',
                 nick1=nick,
                 grade1=newmembers[nick]['grade'],
                 olddata1=olddata,
@@ -410,7 +410,7 @@ def evolution_compare(oldmembers, newmembers, csvfile):
         olddata = oldmembers.get(nick, {}).get('techno', None)
         if newdata is not None and olddata is not None and newdata != olddata:
             publish_line(csvfile, 
-                'TECHNO,{nick1},{grade1},{olddata1},{newdata1},,,,,,,La technologie de {nick1} a atteint le niveau {newdata1}',
+                'TECHNO,{nick1},{grade1},{olddata1},{newdata1},,,,,,La technologie de {nick1} a atteint le niveau {newdata1}',
                 nick1=nick,
                 grade1=newmembers[nick]['grade'],
                 olddata1=olddata,