Browse Source

Fix #2380 Cronômetro não aceita valor acima de 23:59 (#2401)

* fix #2380

* fix 2380

* fix 2380

* fix 2380

* fix #2380
pull/2409/head
Cesar Augusto de Carvalho 6 years ago
committed by Edward
parent
commit
deafb772ee
  1. 35
      sapl/base/migrations/0024_auto_20181126_1534.py
  2. 21
      sapl/base/migrations/0025_auto_20181126_1648.py
  3. 20
      sapl/base/migrations/0026_auto_20181126_1727.py
  4. 8
      sapl/base/models.py
  5. 5
      sapl/base/templatetags/common_tags.py
  6. 1
      sapl/painel/views.py
  7. 15
      sapl/sessao/views.py
  8. 2
      sapl/static/js/app.js

35
sapl/base/migrations/0024_auto_20181126_1534.py

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-11-26 17:34
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0023_auto_20181105_1804'),
]
operations = [
migrations.AlterField(
model_name='appconfig',
name='cronometro_aparte',
field=models.DurationField(blank=True, null=True, verbose_name='Cronômetro do Aparte'),
),
migrations.AlterField(
model_name='appconfig',
name='cronometro_consideracoes',
field=models.DurationField(blank=True, null=True, verbose_name='Cronômetro de Considerações Finais'),
),
migrations.AlterField(
model_name='appconfig',
name='cronometro_discurso',
field=models.DurationField(blank=True, null=True, verbose_name='Cronômetro do Discurso'),
),
migrations.AlterField(
model_name='appconfig',
name='cronometro_ordem',
field=models.DurationField(blank=True, null=True, verbose_name='Cronômetro da Ordem'),
),
]

21
sapl/base/migrations/0025_auto_20181126_1648.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-11-26 18:48
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0024_auto_20181126_1534'),
]
operations = [
migrations.AlterField(
model_name='appconfig',
name='cronometro_discurso',
field=models.DurationField(blank=True, default=datetime.timedelta(0, 2400), null=True, verbose_name='Cronômetro do Discurso'),
),
]

20
sapl/base/migrations/0026_auto_20181126_1727.py

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-11-26 19:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0025_auto_20181126_1648'),
]
operations = [
migrations.AlterField(
model_name='appconfig',
name='cronometro_discurso',
field=models.DurationField(blank=True, null=True, verbose_name='Cronômetro do Discurso'),
),
]

8
sapl/base/models.py

@ -121,22 +121,22 @@ class AppConfig(models.Model):
verbose_name=_('Quem deve assina a ata'),
max_length=1, choices=ASSINATURA_ATA_CHOICES, default='T')
cronometro_discurso = models.TimeField(
cronometro_discurso = models.DurationField(
verbose_name=_('Cronômetro do Discurso'),
blank=True,
null=True)
cronometro_aparte = models.TimeField(
cronometro_aparte = models.DurationField(
verbose_name=_('Cronômetro do Aparte'),
blank=True,
null=True)
cronometro_ordem = models.TimeField(
cronometro_ordem = models.DurationField(
verbose_name=_('Cronômetro da Ordem'),
blank=True,
null=True)
cronometro_consideracoes = models.TimeField(
cronometro_consideracoes = models.DurationField(
verbose_name=_('Cronômetro de Considerações Finais'),
blank=True,
null=True)

5
sapl/base/templatetags/common_tags.py

@ -229,10 +229,7 @@ def cronometro_to_seconds(value):
if not AppConfig.attr('cronometro_' + value):
return 0
m, s, x = AppConfig.attr(
'cronometro_' + value).isoformat().split(':')
return 60 * int(m) + int(s)
return AppConfig.attr('cronometro_' + value).seconds
@register.filter

1
sapl/painel/views.py

@ -340,7 +340,6 @@ def cronometro_painel(request):
def get_cronometro_status(request, name):
logger = logging.getLogger(__name__)
username = request.user.username
try:
logger.debug("user=" + username + ". Tentando obter cronometro.")
cronometro = request.session[name]

15
sapl/sessao/views.py

@ -846,17 +846,10 @@ class PainelView(PermissionRequiredForAppCrudMixin, TemplateView):
messages.add_message(self.request, messages.ERROR, msg)
else:
m, s, x = cronometro_discurso.isoformat().split(':')
cronometro_discurso = int(m) * 60 + int(s)
m, s, x = cronometro_aparte.isoformat().split(':')
cronometro_aparte = int(m) * 60 + int(s)
m, s, x = cronometro_ordem.isoformat().split(':')
cronometro_ordem = int(m) * 60 + int(s)
m, s, x = cronometro_consideracoes.isoformat().split(':')
cronometro_consideracoes = int(m) * 60 + int(s)
cronometro_discurso = cronometro_discurso.seconds
cronometro_aparte = cronometro_aparte.seconds
cronometro_ordem = cronometro_ordem.seconds
cronometro_consideracoes = cronometro_consideracoes.seconds
context = TemplateView.get_context_data(self, **kwargs)
context.update({

2
sapl/static/js/app.js

@ -47,7 +47,7 @@ function refreshMask() {
$('.dateinput').mask('00/00/0000', {placeholder:"__/__/____"});
$('.hora').mask("00:00", {placeholder:"hh:mm"});
$('.hora_hms').mask("00:00:00", {placeholder:"hh:mm:ss"});
$('.cronometro').mask("00:00", {placeholder:"mm:ss"});
$('.cronometro').mask("00:00:00", {placeholder:"hh:mm:ss"});
}
function autorModal() {

Loading…
Cancel
Save