fix: quastat create时年月日bug
This commit is contained in:
parent
3b427cce59
commit
d285e09c5c
|
@ -4,6 +4,7 @@ from apps.utils.serializers import CustomModelSerializer
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from apps.system.models import Dept, Dictionary
|
from apps.system.models import Dept, Dictionary
|
||||||
from apps.wpm.models import SfLog
|
from apps.wpm.models import SfLog
|
||||||
|
from django.utils.timezone import localtime
|
||||||
|
|
||||||
class TestItemSerializer(CustomModelSerializer):
|
class TestItemSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -26,6 +27,7 @@ class QuaStatSerializer(CustomModelSerializer):
|
||||||
attrs['type'] = 'sflog'
|
attrs['type'] = 'sflog'
|
||||||
attrs['belong_dept'] = attrs['sflog'].belong_dept
|
attrs['belong_dept'] = attrs['sflog'].belong_dept
|
||||||
end_time = attrs['sflog'].end_time
|
end_time = attrs['sflog'].end_time
|
||||||
attrs['year_s'], attrs['month_s'], attrs['day_s'] = end_time.year, end_time.month, end_time.day
|
end_time_local = localtime(end_time)
|
||||||
|
attrs['year_s'], attrs['month_s'], attrs['day_s'] = end_time_local.year, end_time_local.month, end_time_local.day
|
||||||
attrs['rate_pass'] = attrs['num_ok']/attrs['num_test']
|
attrs['rate_pass'] = attrs['num_ok']/attrs['num_test']
|
||||||
return attrs
|
return attrs
|
Loading…
Reference in New Issue