fix(terminal): 修复终端列表看到的在线会话数量不对的bug

pull/5963/head
ibuler 2021-04-14 16:28:51 +08:00 committed by Jiangjie.Bai
parent 7da14571ac
commit b0a9a83231
1 changed files with 1 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class StatusSerializer(serializers.ModelSerializer):
class TerminalSerializer(BulkModelSerializer):
session_online = serializers.SerializerMethodField()
session_online = serializers.ReadOnlyField(source='get_online_session_count')
is_alive = serializers.BooleanField(read_only=True)
status = serializers.CharField(read_only=True, source='latest_status')
status_display = serializers.CharField(read_only=True, source='latest_status_display')
@ -73,10 +73,6 @@ class TerminalSerializer(BulkModelSerializer):
else:
raise serializers.ValidationError(_('Not found'))
@staticmethod
def get_session_online(obj):
return Session.objects.filter(terminal=obj, is_finished=False).count()
class TaskSerializer(BulkModelSerializer):
class Meta: