Commit 6c81d4e4 authored by Oleg Borisenko's avatar Oleg Borisenko
Browse files

Added labnum count in stats

parent 57014514
......@@ -21,6 +21,10 @@
<li>из них в архиве - {{ copy_status['copied_wgs_archived_gb'] }} Гбайт</li>
</ul>
<li>лабораторных номеров - {{ copy_status['copied_labnums'] }}</li>
<ul>
<li>из них внутри - {{ copy_status['copied_labnums_inside'] }}</li>
<li>из них в архиве - {{ copy_status['copied_labnums_archived'] }}</li>
</ul>
</ul>
<p class="paragraph">Кассет с данными:</p>
<ul>
......
......@@ -49,6 +49,7 @@ def copy_status(request):
join(models.Tape, models.FileToBackup.tape_label == models.Tape.label).filter(
models.Tape.location != "Inside tape library"
).scalar()
copied_wgs_inside = request.dbsession.query(func.sum(models.FileToBackup.fsize).cast(BIGINT)).filter(
and_(models.FileToBackup.is_file == True,
models.FileToBackup.kind == models.DataKind.wgs,
......@@ -56,6 +57,21 @@ def copy_status(request):
join(models.Tape, models.FileToBackup.tape_label == models.Tape.label).filter(
models.Tape.location == "Inside tape library"
).scalar()
copied_labnums_archived = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).filter(
models.FileToBackup.tape_label != None). \
filter(models.FileToBackup.kind == models.DataKind.wgs). \
join(models.Tape, models.FileToBackup.tape_label == models.Tape.label).filter(
models.Tape.location != "Inside tape library"
).scalar()
copied_labnums_inside = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).filter(
models.FileToBackup.tape_label != None). \
filter(models.FileToBackup.kind == models.DataKind.wgs).\
join(models.Tape, models.FileToBackup.tape_label == models.Tape.label).filter(
models.Tape.location == "Inside tape library"
).scalar()
copied_labnums = request.dbsession.query(func.count(distinct(models.FileToBackup.labnum))).filter(
models.FileToBackup.tape_label != None).\
filter(models.FileToBackup.kind == models.DataKind.wgs).scalar()
......@@ -79,6 +95,8 @@ def copy_status(request):
"copied_wgs_gb": round(copied_wgs / (1024**3), 2),
"copied_wgs_archived_gb": round(copied_wgs_archived / (1024 ** 3), 2),
"copied_wgs_inside_gb": round(copied_wgs_inside / (1024 ** 3), 2),
"copied_labnums_archived": copied_labnums_archived,
"copied_labnums_inside": copied_labnums_inside,
"copied_files": copied_files,
"copied_labnums": copied_labnums}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment