Skip to content

Commit

Permalink
Merge 412c138 into 68bcf81
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeWatt committed Oct 11, 2022
2 parents 68bcf81 + 412c138 commit 1c6cb59
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 12 deletions.
1 change: 1 addition & 0 deletions hepdata/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def _(x):
"bicep2": "@BICEPTWO",
"xenon": "@Xenon1T",
"microboone": "@Microboone",
"belle-II": "@belle2collab",
}

INVALID_DOI_TEMPLATE = "hepdata_theme/invalid_doi.html"
Expand Down
6 changes: 3 additions & 3 deletions hepdata/modules/permissions/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ def write_submissions_to_files():
"""Writes some statistics on number of submissions per Coordinator to files."""

import csv
from datetime import date
from datetime import datetime

# Open a CSV file to write the number of unfinished and finished submissions for each Coordinator.
csvfile = open('submissions_per_coordinator_{}.csv'.format(date.today()), 'w')
csvfile = open('submissions_per_coordinator_{}.csv'.format(datetime.utcnow().date()), 'w')
writer = csv.writer(csvfile)
writer.writerow(['user_id', 'user_email', 'collaboration', 'version',
'number_todo', 'number_finished'])

# Open another CSV file to write the collaboration and date of each finished version 1 submission.
csvfile1 = open('submissions_with_date_{}.csv'.format(date.today()), 'w')
csvfile1 = open('submissions_with_date_{}.csv'.format(datetime.utcnow().date()), 'w')
writer1 = csv.writer(csvfile1)
writer1.writerow(['collaboration', 'publication_recid', 'inspire_id',
'created', 'last_updated'])
Expand Down
2 changes: 1 addition & 1 deletion hepdata/modules/records/utils/records_update_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def _get_time(date):
date_is_int = (type(date) is int or type(date) is str and date.isdigit())

if date_is_int:
specified_time = datetime.datetime.today() + datetime.timedelta(days=-abs(int(date)))
specified_time = datetime.datetime.utcnow() + datetime.timedelta(days=-abs(int(date)))
else:
specified_time = datetime.datetime.strptime(date, "%Y-%m-%d")

Expand Down
29 changes: 24 additions & 5 deletions hepdata/modules/theme/templates/hepdata_theme/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,28 @@
</script>
{%- endblock json_ld %}

{%- block header %}
{# https://developer.twitter.com/en/docs/twitter-for-websites/javascript-api/guides/set-up-twitter-for-websites #}
<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);

t._e = [];
t.ready = function(f) {
t._e.push(f);
};

return t;
}(document, "script", "twitter-wjs"));</script>
<meta name="twitter:dnt" content="on">
<meta name="twitter:widgets:csp" content="on">
{% endblock header %}

{%- block header_bars %}
{%- endblock header_bars %}

Expand Down Expand Up @@ -155,11 +177,8 @@ <h4>Recently Updated Submissions - <a href="search/?q=&sort_order=&sort_by=lates
</div>

<div class="twitter-area">
<a class="twitter-timeline" data-width="800" data-height="200" data-dnt="true"
href="https://twitter.com/HEPData?ref_src=twsrc%5Etfw">
Tweets by HEPData
</a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
<a class="twitter-timeline" data-height="200"
href="https://twitter.com/HEPData?ref_src=twsrc%5Etfw">Tweets by HEPData</a>
</div>

{% include "hepdata_search/modals/search_help.html" %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,11 @@ <h4 class="text-center"><img src="static/img/about/cern-logo.svg" width="130px">

<ul class="talks">
{% with talks = [
{'meeting': 'Belle II Data Preservation Workshop',
'location': 'Roma Tre University, Rome',
'speaker': 'Graeme Watt',
'date': 'Oct 2022',
'link': 'https://indico.belle2.org/event/7653/contributions/44066/attachments/18872/28052/watt_hepdata_oct2022.pdf'},
{'meeting': 'STRONG-2020 meeting on database for hadronic cross sections',
'location': 'Virtual Zoom',
'speaker': 'Graeme Watt',
Expand Down
2 changes: 1 addition & 1 deletion hepdata/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
and parsed by ``setup.py``.
"""

__version__ = "0.9.4dev20220926"
__version__ = "0.9.4dev20221012"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

tests_require = [
'pytest>=6.0.2',
'pytest-cov>=2.9.0',
'pytest-cov>=2.9.0,<4.0.0',
'pytest-flask>=1.0.0',
'pytest-mock>=3.1.0',
'pytest-timeout>=1.4.2',
Expand Down
2 changes: 1 addition & 1 deletion tests/dashboard_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ def test_submissions_csv(app, admin_idx, load_default_data, identifiers):
csv_lines = csv_data.splitlines()
assert len(csv_lines) == 3
assert csv_lines[0] == 'hepdata_id,version,url,inspire_id,arxiv_id,title,collaboration,creation_date,last_updated,status,uploaders,reviewers'
today = datetime.date.today().isoformat()
today = datetime.datetime.utcnow().date().isoformat()
assert csv_lines[1] == f'16,1,http://localhost/record/16,1245023,arXiv:1307.7457,High-statistics study of $K^0_S$ pair production in two-photon collisions,Belle,{today},2013-12-17,finished,,'
assert csv_lines[2] == f'1,1,http://localhost/record/1,1283842,arXiv:1403.1294,Measurement of the forward-backward asymmetry in the distribution of leptons in $t\\bar{{t}}$ events in the lepton$+$jets channel,D0,{today},2014-08-11,finished,,'

Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ def finalizer():
cookie_accept_btn = browser.find_element(By.CSS_SELECTOR, ".cc_btn_accept_all")
cookie_accept_btn.click()

# Wait for Twitter timeline to render
WebDriverWait(browser, 10).until(
EC.presence_of_element_located((By.CLASS_NAME, 'twitter-timeline-rendered'))
)

# Add finalizer to quit the webdriver instance
request.addfinalizer(finalizer)

Expand Down

0 comments on commit 1c6cb59

Please sign in to comment.