Commit 5d7ec0415983cdf5f9fedc22de5c91b438c41a8e

Authored by Zambom
1 parent cbd89f4e

Pendencies adjusts (part 2)

amadeus/settings.py
@@ -209,8 +209,8 @@ CRON_CLASSES = [ @@ -209,8 +209,8 @@ CRON_CLASSES = [
209 ] 209 ]
210 210
211 CRONJOBS = [ 211 CRONJOBS = [
212 - ('1 */12 * * *', 'notifications.cron.notification_cron'),  
213 - ('1 */12 * * *', 'goals.cron.setgoals_cron') 212 + ('0 0 * * *', 'notifications.cron.notification_cron'),
  213 + ('0 0 * * *', 'goals.cron.setgoals_cron')
214 ] 214 ]
215 215
216 CHANNEL_LAYERS = { 216 CHANNEL_LAYERS = {
chat/migrations/0004_merge_20170413_2034.py 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10.4 on 2017-04-13 23:34
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('chat', '0003_auto_20170407_2251'),
  12 + ('chat', '0003_auto_20170407_2154'),
  13 + ]
  14 +
  15 + operations = [
  16 + ]
news/migrations/0002_auto_20170413_2034.py 0 → 100644
@@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10.4 on 2017-04-13 23:34
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations, models
  6 +import news.models
  7 +
  8 +
  9 +class Migration(migrations.Migration):
  10 +
  11 + dependencies = [
  12 + ('news', '0001_initial'),
  13 + ]
  14 +
  15 + operations = [
  16 + migrations.AlterField(
  17 + model_name='news',
  18 + name='image',
  19 + field=models.ImageField(blank=True, upload_to='news/', validators=[news.models.validate_img_extension], verbose_name='News Image'),
  20 + ),
  21 + migrations.AlterField(
  22 + model_name='news',
  23 + name='title',
  24 + field=models.CharField(max_length=200, unique=True, verbose_name='Title'),
  25 + ),
  26 + ]
notifications/migrations/0003_notification_aware.py 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10.4 on 2017-04-13 23:34
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations, models
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('notifications', '0002_auto_20170130_1828'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.AddField(
  16 + model_name='notification',
  17 + name='aware',
  18 + field=models.BooleanField(default=False, verbose_name='Aware'),
  19 + ),
  20 + ]
notifications/migrations/0004_remove_notification_aware.py 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +# -*- coding: utf-8 -*-
  2 +# Generated by Django 1.10.4 on 2017-04-13 23:40
  3 +from __future__ import unicode_literals
  4 +
  5 +from django.db import migrations
  6 +
  7 +
  8 +class Migration(migrations.Migration):
  9 +
  10 + dependencies = [
  11 + ('notifications', '0003_notification_aware'),
  12 + ]
  13 +
  14 + operations = [
  15 + migrations.RemoveField(
  16 + model_name='notification',
  17 + name='aware',
  18 + ),
  19 + ]
notifications/templates/notifications/_ajax_history.html
@@ -44,6 +44,11 @@ @@ -44,6 +44,11 @@
44 </a> 44 </a>
45 </th> 45 </th>
46 <th> 46 <th>
  47 + <a href="javascript: orderBy({{ subject_id }}, '{{ request|order_ajax:'aware' }}')">
  48 + {% trans 'Aware' %} <i class="fa fa-fw {{ request|order_icon_class:'aware' }} pull-right"></i>
  49 + </a>
  50 + </th>
  51 + <th>
47 <a href="javascript: orderBy({{ subject_id }}, '{{ request|order_ajax:'obs' }}'')"> 52 <a href="javascript: orderBy({{ subject_id }}, '{{ request|order_ajax:'obs' }}'')">
48 {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i> 53 {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i>
49 </a> 54 </a>
@@ -58,12 +63,13 @@ @@ -58,12 +63,13 @@
58 <td>{{ notification.task.get_action_display }}</td> 63 <td>{{ notification.task.get_action_display }}</td>
59 <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td> 64 <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td>
60 <td>{{ notification.level|warning_msg }}</td> 65 <td>{{ notification.level|warning_msg }}</td>
  66 + <td>{{ notification.viewed|viewed_msg }}</td>
61 <td>{{ notification|observation }}</td> 67 <td>{{ notification|observation }}</td>
62 </tr> 68 </tr>
63 {% endfor %} 69 {% endfor %}
64 {% else %} 70 {% else %}
65 <tr> 71 <tr>
66 - <td colspan="6" class="text-center">{% trans 'No results found' %}</td> 72 + <td colspan="7" class="text-center">{% trans 'No results found' %}</td>
67 </tr> 73 </tr>
68 {% endif %} 74 {% endif %}
69 </tbody> 75 </tbody>
notifications/templates/notifications/_history.html
@@ -43,6 +43,11 @@ @@ -43,6 +43,11 @@
43 </a> 43 </a>
44 </th> 44 </th>
45 <th> 45 <th>
  46 + <a href="{{ request|order_href:'aware' }}">
  47 + {% trans 'Aware' %} <i class="fa fa-fw {{ request|order_icon_class:'aware' }} pull-right"></i>
  48 + </a>
  49 + </th>
  50 + <th>
46 <a href="{{ request|order_href:'obs' }}"> 51 <a href="{{ request|order_href:'obs' }}">
47 {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i> 52 {% trans 'Observation' %} <i class="fa fa-fw {{ request|order_icon_class:'obs' }} pull-right"></i>
48 </a> 53 </a>
@@ -57,12 +62,13 @@ @@ -57,12 +62,13 @@
57 <td>{{ notification.task.get_action_display }}</td> 62 <td>{{ notification.task.get_action_display }}</td>
58 <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td> 63 <td>{{ notification.task.end_date|date:"SHORT_DATE_FORMAT"|default:_('Not Informed') }}</td>
59 <td>{{ notification.level|warning_msg }}</td> 64 <td>{{ notification.level|warning_msg }}</td>
  65 + <td>{{ notification.viewed|viewed_msg }}</td>
60 <td>{{ notification|observation }}</td> 66 <td>{{ notification|observation }}</td>
61 </tr> 67 </tr>
62 {% endfor %} 68 {% endfor %}
63 {% else %} 69 {% else %}
64 <tr> 70 <tr>
65 - <td colspan="6" class="text-center">{% trans 'No results found' %}</td> 71 + <td colspan="7" class="text-center">{% trans 'No results found' %}</td>
66 </tr> 72 </tr>
67 {% endif %} 73 {% endif %}
68 </tbody> 74 </tbody>
notifications/templatetags/notification_filters.py
@@ -34,6 +34,15 @@ def warning_msg(level): @@ -34,6 +34,15 @@ def warning_msg(level):
34 34
35 return msg 35 return msg
36 36
  37 +@register.filter(name = 'viewed_msg')
  38 +def viewed_msg(aware):
  39 + if aware:
  40 + msg = _('Yes')
  41 + else:
  42 + msg = _('No')
  43 +
  44 + return msg
  45 +
37 @register.filter(name = 'done_percent') 46 @register.filter(name = 'done_percent')
38 def done_percent(notification): 47 def done_percent(notification):
39 users = get_resource_users(notification.task.resource) 48 users = get_resource_users(notification.task.resource)
@@ -117,12 +126,12 @@ def observation(notification): @@ -117,12 +126,12 @@ def observation(notification):
117 126
118 if notification.level == 1: 127 if notification.level == 1:
119 if notification.meta: 128 if notification.meta:
120 - msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) 129 + msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT"))
121 elif notification.level == 2: 130 elif notification.level == 2:
122 if notification.meta: 131 if notification.meta:
123 if notification.meta < timezone.now(): 132 if notification.meta < timezone.now():
124 - msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) 133 + msg = _('Goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT"))
125 else: 134 else:
126 - msg = _('New goal defined to task realization: %s')%(formats.date_format(notification.meta, "SHORT_DATETIME_FORMAT")) 135 + msg = _('New goal defined to task realization: %s')%(formats.date_format(notification.meta.astimezone(timezone.get_current_timezone()), "SHORT_DATETIME_FORMAT"))
127 136
128 return msg 137 return msg
129 \ No newline at end of file 138 \ No newline at end of file
notifications/utils.py
@@ -94,6 +94,11 @@ def get_order_by(order): @@ -94,6 +94,11 @@ def get_order_by(order):
94 return ["-level"] 94 return ["-level"]
95 else: 95 else:
96 return ["level"] 96 return ["level"]
  97 + elif "aware" in order:
  98 + if "-" in order:
  99 + return ["-viewed"]
  100 + else:
  101 + return ["viewed"]
97 elif "obs" in order: 102 elif "obs" in order:
98 if "-" in order: 103 if "-" in order:
99 return ["-meta"] 104 return ["-meta"]