Skip to content

Commit

Permalink
mostrar minutos
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nt-s committed Feb 8, 2021
1 parent a17b55a commit 28f7355
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions core/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from MySQLdb.cursors import DictCursor
from dateutil.relativedelta import relativedelta
from bunch import Bunch
from math import floor

from datetime import datetime
from dateutil.relativedelta import relativedelta
Expand Down Expand Up @@ -185,10 +186,13 @@ def strikes(self):
where """+cut_date
strikes = self.db.one(i_sql, cursor=DictCursor)
ratio = (self.cut_date - strikes['ini'].date())
ratio = ratio.days * 24
ratio = ratio / strikes['total']
ratio = round(ratio)
strikes['ratio'] = ratio
ratio = ratio.days * 24 * 60
ratio = round(ratio / strikes['total'])
horas = floor(ratio/60)
strikes['ratio'] = {
"horas": horas,
"minutos": ratio-(horas*60)
}
strikes['actividad'] = self.db.one('''
select
sum(comments) comments,
Expand Down
1 change: 1 addition & 0 deletions docs/i2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ <h1>1. ¿Cuántos strikes hay?</h1>
<p>
En números absolutos, ha habido aproximadamente
un strike cada <code>3</code> horas
y <code>18</code> minutos,
y se han visto afectados un total de
<code>3.371</code> usuarios.
</p>
Expand Down
3 changes: 2 additions & 1 deletion template/i2.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ <h1>1. ¿Cuántos strikes hay?</h1>
</ol>
<p>
En números absolutos, ha habido aproximadamente
un strike cada <code>{{st.strikes.ratio}}</code> horas
un strike cada <code>{{st.strikes.ratio.horas}}</code> horas
y <code>{{st.strikes.ratio.minutos}}</code> minutos,
y se han visto afectados un total de
<code>{{st.strikes.usuarios | millar}}</code> usuarios.
</p>
Expand Down

0 comments on commit 28f7355

Please sign in to comment.