Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the dashboard estimate to only use the last 30 days of results #280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions web/dashboard/views.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright (C) 2010-2015 Cuckoo Foundation.
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.

import sys
import time
import datetime


from django.conf import settings
from django.template import RequestContext
Expand Down Expand Up @@ -56,14 +58,16 @@ def index(request):
tasks += db.list_tasks(offset=offset, status=TASK_REPORTED)

if tasks:
tasksubset = [x for x in tasks if timestamp(x.started_on) >= timestamp(datetime.datetime.today() - timedelta(days=30))]

# Get the time when the first task started.
started = min(timestamp(task.started_on) for task in tasks)
started = min(timestamp(task.started_on) for task in tasksubset)

# Get the time when the last task completed.
completed = max(timestamp(task.completed_on) for task in tasks)
completed = max(timestamp(task.completed_on) for task in tasksubset)

# Get the amount of tasks that actually completed.
finished = len(tasks)
finished = len(tasksubset)

# It has happened that for unknown reasons completed and started were
# equal in which case an exception is thrown, avoid this.
Expand Down