mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-24 17:04:25 +01:00
adding dedicated_time attribute to Queue model
This commit is contained in:
parent
6ceb89a5cb
commit
2093bf7faf
@ -8,9 +8,17 @@ from helpdesk.models import CustomField
|
||||
|
||||
@admin.register(Queue)
|
||||
class QueueAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'slug', 'email_address', 'locale')
|
||||
list_display = ('title', 'slug', 'email_address', 'locale', 'time_spent')
|
||||
prepopulated_fields = {"slug": ("title",)}
|
||||
|
||||
def time_spent(self, q):
|
||||
if q.dedicated_time:
|
||||
return "{} / {}".format(q.time_spent, q.dedicated_time)
|
||||
elif q.time_spent:
|
||||
return q.time_spent
|
||||
else:
|
||||
return "-"
|
||||
|
||||
|
||||
@admin.register(Ticket)
|
||||
class TicketAdmin(admin.ModelAdmin):
|
||||
|
18
helpdesk/migrations/0025_queue_dedicated_time.py
Normal file
18
helpdesk/migrations/0025_queue_dedicated_time.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 2.0.5 on 2019-02-19 21:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('helpdesk', '0024_time_spent'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='queue',
|
||||
name='dedicated_time',
|
||||
field=models.DurationField(blank=True, help_text='Time to be spent on this Queue in total', null=True),
|
||||
),
|
||||
]
|
@ -276,6 +276,11 @@ class Queue(models.Model):
|
||||
verbose_name=_('Default owner'),
|
||||
)
|
||||
|
||||
dedicated_time = models.DurationField(
|
||||
help_text=_("Time to be spent on this Queue in total"),
|
||||
blank=True, null=True
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % self.title
|
||||
|
||||
|
@ -18,6 +18,7 @@ class TicketSerializer(serializers.ModelSerializer):
|
||||
due_date = serializers.SerializerMethodField()
|
||||
status = serializers.SerializerMethodField()
|
||||
row_class = serializers.SerializerMethodField()
|
||||
time_spent = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = Ticket
|
||||
@ -47,5 +48,8 @@ class TicketSerializer(serializers.ModelSerializer):
|
||||
else:
|
||||
return ("None")
|
||||
|
||||
def get_time_spent(self, obj):
|
||||
return str(obj.time_spent)
|
||||
|
||||
def get_row_class(self, obj):
|
||||
return (obj.get_priority_css_class)
|
||||
|
@ -55,7 +55,7 @@
|
||||
<td>{% if queue.open %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=1&status=2'>{% endif %}{{ queue.open }}{% if queue.open %}</a>{% endif %}</td>
|
||||
<td>{% if queue.resolved %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=3'>{% endif %}{{ queue.resolved }}{% if queue.resolved %}</a>{% endif %}</td>
|
||||
<td>{% if queue.closed %}<a href='{{ hdlist }}?queue={{ queue.queue }}&status=4'>{% endif %}{{ queue.closed }}{% if queue.closed %}</a>{% endif %}</td>
|
||||
<td>{{ queue.time_spent }}</td>
|
||||
<td>{{ queue.time_spent }}{% if queue.dedicated_time %} / {{ queue.dedicated_time }}{% endif %}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
<tr><td colspan='6'>{% trans "There are no unassigned tickets." %}</td></tr>
|
||||
|
@ -1172,7 +1172,8 @@ def report_index(request):
|
||||
'open': queue.ticket_set.filter(status__in=[1, 2]).count(),
|
||||
'resolved': queue.ticket_set.filter(status=3).count(),
|
||||
'closed': queue.ticket_set.filter(status=4).count(),
|
||||
'time_spent': queue.time_spent
|
||||
'time_spent': queue.time_spent,
|
||||
'dedicated_time': queue.dedicated_time
|
||||
}
|
||||
dash_tickets.append(dash_ticket)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user