From 4feab4e85475834fafa930291934b441d1611e44 Mon Sep 17 00:00:00 2001 From: zsloan Date: Fri, 21 Oct 2016 19:53:36 +0000 Subject: Added metadata to "Download Table" Only checked traits are now downloaded and all traits are downloaded if nothing is checked --- wqflask/wqflask/export_traits.py | 14 +++++++++++- .../static/new/javascript/search_results.js | 25 ++++++++++++++++------ wqflask/wqflask/templates/search_result_page.html | 1 + 3 files changed, 33 insertions(+), 7 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/export_traits.py b/wqflask/wqflask/export_traits.py index 280566d7..eeed72f1 100644 --- a/wqflask/wqflask/export_traits.py +++ b/wqflask/wqflask/export_traits.py @@ -4,6 +4,7 @@ import operator import csv import xlsxwriter import StringIO +import datetime import simplejson as json @@ -18,10 +19,21 @@ def export_search_results_csv(targs): buff = StringIO.StringIO() writer = csv.writer(buff) + metadata = [] + + metadata.append(["Citations: Please see www.genenetwork.org/reference.html"]) + metadata.append(["Database: " + targs['database_name']]) + metadata.append(["Date: " + datetime.datetime.now().strftime("%B %d, %Y")]) + metadata.append(["Time: " + datetime.datetime.now().strftime("%H:%M GMT")]) + metadata.append(["Status of data ownership: Possibly unpublished data; please see www.genenetwork.org/statusandContact.html for details on sources, ownership, and usage of these data."]) + + for metadata_row in metadata: + writer.writerow(metadata_row) + writer.writerow(table_headers) for trait_info in table_rows: writer.writerow(trait_info) - + csv_data = buff.getvalue() buff.close() diff --git a/wqflask/wqflask/static/new/javascript/search_results.js b/wqflask/wqflask/static/new/javascript/search_results.js index 54a61a45..5250523f 100644 --- a/wqflask/wqflask/static/new/javascript/search_results.js +++ b/wqflask/wqflask/static/new/javascript/search_results.js @@ -174,13 +174,26 @@ $(function() { rows = []; trait_table.find('tbody tr').each(function (i, tr) { - this_row = []; - $(tr).find('td').each(function(j, td){ - if ($(td).data('export')){ - this_row.push($(td).data('export')); + if (trait_table.find('input[name="searchResult"]:checked').length > 0) { + if ($(this).find('input[name="searchResult"]').is(':checked')){ + this_row = []; + $(tr).find('td').each(function(j, td){ + if ($(td).data('export')){ + this_row.push($(td).data('export')); + } + }); + rows.push(this_row); } - }); - rows.push(this_row); + } + else { + this_row = []; + $(tr).find('td').each(function(j, td){ + if ($(td).data('export')){ + this_row.push($(td).data('export')); + } + }); + rows.push(this_row); + } }); table_dict['rows'] = rows; console.log("TABLEDICT:", table_dict); diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html index 13993e83..f44714f3 100644 --- a/wqflask/wqflask/templates/search_result_page.html +++ b/wqflask/wqflask/templates/search_result_page.html @@ -59,6 +59,7 @@

+
-- cgit v1.2.3