Skip to content

Commit

Permalink
Merge branch 'develop' into feature/3570_incorrect_issns
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-Eardley committed Aug 17, 2023
2 parents f368160 + eba5386 commit 7626ffe
Show file tree
Hide file tree
Showing 40 changed files with 604 additions and 105 deletions.
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ Instructions for reviewers:
- [ ] Developer
- [ ] Reviewer

- Have CSS/style changes been implemented? If they are of a global scope (e.g. on base HTML elements) have the downstream impacts of the change in other areas of the system been considered?
- [ ] N/A
- [ ] Developer
- [ ] Reviewer

### Documentation

- FeatureMap annotations have been added
Expand Down
5 changes: 5 additions & 0 deletions cms/data/notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,8 @@ update_request:publisher:rejected:notify:
short:
Your update request was rejected

journal:assed:discontinuing_soon:notify:
long: |
Journal "{title}" (id: {id}) will discontinue in {days} days.
short:
Journal discontinuing
19 changes: 0 additions & 19 deletions cms/data/team.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@
2020: https://drive.google.com/file/d/1-4wTgvwCu_tvDv5NIoJhZi0QpQl-fpdB/view?usp=sharing
2022: https://drive.google.com/file/d/1xEUUxhqSE0OnKd_x8z1oLLRRrJrKAwXA/view?usp=sharing

- name: Ilaria Fava
role: Managing Editor
photo: Ilaria.jpg
bio: 'Ilaria is a librarian with several years of experience within the Open Access community in her home country of Italy, where she has dealt with Open Access issues at both national and international level. She also serves the Göttingen State and University Library working on Open Science projects.
Based in Rome and Göttingen, Ilaria loves baking cakes; she speaks Italian, English, some Spanish and a little German.'
coi:
2016: https://drive.google.com/file/d/0ByRf6PVViI-mY2dRZTR5eTFjQkk/view?usp=sharing&resourcekey=0-fPa6ce_HjfoVQqKGqWxLNw
2018: https://drive.google.com/file/d/1AMi0uIWHgEiaqmJLM7f_SFsiLEJENfjF/view?usp=sharing
2020: https://drive.google.com/file/d/1jWZKc6xjp3yfo6qjQWp6Yp3y-71ZHLth/view?usp=sharing
2022: https://drive.google.com/file/d/1_au6llN2ALPnkNTgUrzLrSTw8gundldJ/view?usp=sharing

- name: Joanna Ball
role: Managing Director
photo: joba.jpg
Expand Down Expand Up @@ -120,14 +109,6 @@ Based in Rome and Göttingen, Ilaria loves baking cakes; she speaks Italian, Eng
2020: https://drive.google.com/file/d/1zU-lLB5W54E_QUm5uto5tqB6cZl83TAJ/view?usp=sharing
2022: https://drive.google.com/file/d/19rw-naMJqHkI5T7aDIDPUkwPutBdDpDm/view?usp=sharing

- name: Louise Stoddard
role: Communications Manager
photo: louise.jpg
bio: "Louise has over 15 years experience in communications and public relations for non-profit and international organisations. She holds a Masters in Journalism and a Bachelor of Science and Economics in International Development from The University of Wales, Swansea. Louise has worked for the United Nations for 8 years, also with academic and non-profit organisations promoting access to knowledge and information. In 2021 Louise joined DOAJ as the focal point for public relations and communications. Outside of work Louise can usually be found in her vegetable garden."
coi:
2021: https://drive.google.com/file/d/1DmDsIkv-orjF7QGEVwqFDAl0EQx3qRXg/view?usp=sharing
2022: https://drive.google.com/file/d/1wOeX97BZGEX50orKo6TwlWmGsdbLFfBD/view?usp=sharing

- name: Luis Montilla
role: Managing Editor
photo: luis.jpeg
Expand Down
4 changes: 2 additions & 2 deletions cms/data/volunteers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ ass_ed:
- name: Kadri Kıran
area: Systematic Entomology
year_since:
city: Tekirdag
country: Turkey
city: Edirne
country: Türkiye
language: English, Turkish, German
photo: "Kadri Kiran.jpg"

Expand Down
31 changes: 10 additions & 21 deletions cms/pages/about/at-20.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ Further down the page is a historical timeline to give you a full overview of DO
[//]: # (NB. adding whitespace around the titles will break styling)
{.events .unstyled-list}
- {% include "includes/svg/at-20/theme_open.svg" %}
- **[Registration is open](https://us02web.zoom.us/webinar/register/WN_-b000to3RZKexuFsJGJw1g#/registration)**
- **[Recording is available](https://www.youtube.com/watch?v=qnpSdX3eusk)**
- Name: _DOAJ at 20: Open_
- Date: 15th June 2023
- Event Time: 13:00 UTC ([Check the event time](https://www.timeanddate.com/worldclock/fixedtime.html?iso=20230615T13&ah=1&am=30) where you are.)
- Event Time: 13:00 UTC
- Duration: 90 mins
- {% include "includes/svg/at-20/theme_global.svg" %}
- **[Registration is open](https://us02web.zoom.us/webinar/register/WN_fu42oi59S7GZ366rjyAUGg#/registration)**
- Name: _DOAJ at 20: Global_
- Date: _28th September 2023_
- Event Time: to be confirmed
- Duration: 90 mins
- Event Time: 13:00 UTC ([Check the event time](https://www.timeanddate.com/worldclock/fixedtime.html?iso=20230928T13&ah=1&am=30) where you are.)
- Duration: 2 hours
- {% include "includes/svg/at-20/theme_trusted.svg" %}
- Name: _DOAJ at 20: Trusted_
- Date: _7th December 2023_
Expand All @@ -41,27 +42,15 @@ Further down the page is a historical timeline to give you a full overview of DO

## Open

Join us for the first of three events marking our 20th anniversary as a key open infrastructure. 'DOAJ at 20: Open' is free and open to researchers, librarians, research support staff, publishers, and anyone interested in open access!

The event will build around the theme ‘open’, where our moderator (Abeni Wickham) will be chatting with our three guests: Lars Bjørnshauge, Mikael Laakso, and Nadine Buckland. The discussion will focus on their thoughts and aspirations on open scholarship. They will also explore the obstacles and challenges in adopting immediate open access.

The event will last 90 minutes.

**Abeni Wickham**

Abeni was born in Guyana, South America and holds a PhD in Molecular Physics from Linkoping University. She left academia in 2018 to create SciFree, a software company with a mission to make research open to the public for free. SciFree currently serves 45 University Library customers in Sweden, Denmark, the United Kingdom and the USA. Besides building new tech platforms for university infrastructure, Abeni volunteers on the NASIG Digital Preservation committee, helps PhDs transition in their careers and enjoys surfing both actual waves and the Open Access wave worldwide.

**Lars Bjørnshauge**

Lars Bjørnshauge is the Director of Infrastructure Services for Open Access C.I.C (www.is4oa.org). A true open access champion, Lars is DOAJ’s founder and worked as the Managing Director until 2022. Previously, he has been the Deputy Director and Acting Director for the Technical Information Center of Denmark at the Technical University of Denmark. Lars has also been the Director of Libraries at Lund University in Sweden, and the Director of SPARC Europe. In addition to founding DOAJ, he has also co-founded OpenDOAR (the Directory of Open Access Repositories, DOAB (Directory of Open Access Books), and Think.Check.Submit. Lars was on the OASPA Board from 2012-2019.
Our first of three events marking our 20th anniversary took place on the 15th June 2023. The event was built around the theme ‘open’, where our moderator (Abeni Wickham) had a coversation with our three guests: Lars Bjørnshauge, Mikael Laakso, and Nadine Buckland. The discussion focused on development and changes over the last 20 years, with reflections from all speakers on what the next years will bring. A recording of the event is [available on YouTube](https://www.youtube.com/watch?v=qnpSdX3eusk).

**Mikael Laakso**
## Global

Mikael Laakso is an Associate Professor in Information Systems Science at Hanken School of Economics in Helsinki. He has been researching the changing landscape towards openness in scholarly publishing by studying combinations of bibliometrics, web metrics, business models, science policy, and author behaviour. Since the start of his research in this domain around 2009, DOAJ data has been instrumental to most of his research projects. In addition to research, Mikael has also been active in national and international working groups furthering various dimensions of open science.
Our second event will be around the theme Global, where we will have eight lighting talks from speakers from around the world. Our moderator and DOAJ Ambassador, Ivonne Lujano, will introduce speakers and manage two Q&As, where the audience can ask our speakers questions. More information about the event and all the speakers can be found on the [registration page](https://us02web.zoom.us/webinar/register/WN_fu42oi59S7GZ366rjyAUGg#/registration).

**Nadine D. Tulloch-Buckland**
## Trusted

Nadine D. Tulloch-Buckland is the former General Manager of the UWI Press, Senior Lecturer of the University of the West Indies and Director of Spoizer Content Agency Limited. She has over twenty years’ experience in scholarly publishing with specific emphasis on finance and business model development geared towards sustainability in scholarly publishing in the Caribbean. Nadine is the current Treasurer of ALPSP and former Treasurer/Director of AUPresses. She is an advocate for Sustainable Open Access Publishing.
Our third and last DOAJ at 20 event will be around the theme Trusted. More information about this event will be available later in the year.

## Timeline

Expand Down
1 change: 0 additions & 1 deletion cms/pages/about/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ featuremap: ~~Team:Fragment->TeamData:Template~~

---


9 changes: 7 additions & 2 deletions doajtest/fixtures/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
"http://www.moonlight.com",
"https://www.cosmos.com#galaxy",
"https://www.cosmos.com/galaxy",
"https://www.cosmos.com/galaxy#peanut"
"https://www.cosmos.com/galaxy#peanut",
"http://ftp.example.com/file%20name.txt"
]

INVALID_URL_LISTS = [
"ht:www",
"nonexistent.com",
"https://www.doaj.org and https://www.reddit.com"
"https://www.doaj.org and https://www.reddit.com",
"http://www.doaj.org and www.doaj.org",
"http://www.doaj.org, www.doaj.org",
"http://www.doaj.org, https://www.doaj.org",
"http://ftp.example.com/file name.txt"
]
15 changes: 15 additions & 0 deletions doajtest/testbook/public_site/ToC.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
suite: Public Site
testset: ToC
tests:
- title: Test Correctly Displayed Discontinued Date
context:
role: anonymous
steps:
- step: To prepare to do this test make sure there are 3 journals publically available in DOAJ
one with discontinued date in the past
one with discontinued date in the future
one with discontinued date today
- step: Search for every journal from the list above
results:
- On the ToC of the journal with discontinued date in the past or today - the discontinued date is displayed
- On the ToC of the journal with discontinued date in the future - the discontinued date is not displayed
4 changes: 2 additions & 2 deletions doajtest/unit/api_tests/test_apiv3_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def test_03_applications(self):
for i in range(5):
a = models.Suggestion()
a.set_owner("owner")
a.set_created(dates.format(dates.after(now, i)))
a.set_created(dates.format(dates.seconds_after(now, i)))
bj = a.bibjson()
bj.title = "Test Suggestion {x}".format(x=i)
bj.add_identifier(bj.P_ISSN, "{x}000-0000".format(x=i))
Expand All @@ -256,7 +256,7 @@ def test_03_applications(self):
for i in range(5):
a = models.Suggestion()
a.set_owner("stranger")
a.set_created(dates.format(dates.after(now, i + 5)))
a.set_created(dates.format(dates.seconds_after(now, i + 5)))
bj = a.bibjson()
bj.title = "Test Suggestion {x}".format(x=i)
bj.add_identifier(bj.P_ISSN, "{x}000-0000".format(x=i))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
from portality import models
from portality import constants
from portality.bll import exceptions
from doajtest.helpers import DoajTestCase
from doajtest.fixtures import JournalFixtureFactory, ApplicationFixtureFactory
from portality.events.consumers.journal_discontinuing_soon_notify import JournalDiscontinuingSoonNotify
from doajtest.fixtures import BackgroundFixtureFactory
import time

# Mock required to make application lookup work
@classmethod
def pull_application(cls, id):
app = models.Application(**ApplicationFixtureFactory.make_application_source())
return app

@classmethod
def pull_by_key(cls, key, value):
ed = models.EditorGroup()
acc = models.Account()
acc.set_id('testuser')
acc.set_email("test@example.com")
acc.save(blocking=True)
ed.set_maned(acc.id)
ed.save(blocking=True)

return ed

class TestJournalDiscontinuingSoonNotify(DoajTestCase):
def setUp(self):
super(TestJournalDiscontinuingSoonNotify, self).setUp()
self.pull_application = models.Application.pull
models.Application.pull = pull_application
self.pull_by_key = models.EditorGroup.pull_by_key
models.EditorGroup.pull_by_key = pull_by_key

def tearDown(self):
super(TestJournalDiscontinuingSoonNotify, self).tearDown()
models.Application.pull = self.pull_application
models.EditorGroup.pull_by_key = self.pull_by_key

def test_consumes(self):

event = models.Event("test:event", context={"data" : {"1234"}})
assert not JournalDiscontinuingSoonNotify.consumes(event)

event = models.Event("test:event", context={"data": {}})
assert not JournalDiscontinuingSoonNotify.consumes(event)

event = models.Event(constants.EVENT_JOURNAL_DISCONTINUING_SOON)
assert not JournalDiscontinuingSoonNotify.consumes(event)

event = models.Event(constants.EVENT_JOURNAL_DISCONTINUING_SOON, context = {"journal": {"1234"}, "discontinue_date": "2002-22-02"})
assert JournalDiscontinuingSoonNotify.consumes(event)

def test_consume_success(self):
self._make_and_push_test_context("/")

source = BackgroundFixtureFactory.example()
bj = models.BackgroundJob(**source)
# bj.save(blocking=True)

acc = models.Account()
acc.set_id('testuser')
acc.set_email("test@example.com")
acc.add_role('admin')
acc.save(blocking=True)

source = JournalFixtureFactory.make_journal_source()
journal = models.Journal(**source)
journal.save(blocking=True)

event = models.Event(constants.BACKGROUND_JOB_FINISHED, context={"job" : bj.data, "journal" : journal.id})
JournalDiscontinuingSoonNotify.consume(event)

time.sleep(2)
ns = models.Notification.all()
assert len(ns) == 1

n = ns[0]
assert n.who == acc.id
assert n.created_by == JournalDiscontinuingSoonNotify.ID
assert n.classification == constants.NOTIFICATION_CLASSIFICATION_STATUS
assert n.long is not None
assert n.short is not None
assert n.action is not None
assert not n.is_seen()
93 changes: 93 additions & 0 deletions doajtest/unit/test_task_discontinued_soon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import unittest
import datetime

from doajtest.helpers import DoajTestCase, patch_config

from portality import models
from portality.tasks import find_discontinued_soon
from portality.ui.messages import Messages
from doajtest.fixtures import JournalFixtureFactory

# Expect a notification for journals discontinuing in 1 days time (tomorrow)
DELTA = 1


class TestDiscontinuedSoon(DoajTestCase):

@classmethod
def setUpClass(cls) -> None:
super().setUpClass()
cls.orig_config = patch_config(cls.app_test, {
'DISCONTINUED_DATE_DELTA': DELTA
})

@classmethod
def tearDownClass(cls) -> None:
super().tearDownClass()
patch_config(cls.app_test, cls.orig_config)

@staticmethod
def _date_to_find():
return (datetime.datetime.today() + datetime.timedelta(days=DELTA)).strftime('%Y-%m-%d')

@staticmethod
def _date_too_late():
return (datetime.datetime.today() + datetime.timedelta(days=DELTA+1)).strftime('%Y-%m-%d')

def test_discontinued_soon_found(self):

# Both these should be found
journal_discontinued_to_found_1 = models.Journal(**JournalFixtureFactory.make_journal_source(in_doaj=True))
journal_discontinued_to_found_1.set_id("1")
jbib = journal_discontinued_to_found_1.bibjson()
jbib.title = "Discontinued Tomorrow 1"
jbib.discontinued_date = self._date_to_find()
journal_discontinued_to_found_1.save(blocking=True)

journal_discontinued_to_found_2 = models.Journal(**JournalFixtureFactory.make_journal_source(in_doaj=True))
journal_discontinued_to_found_2.set_id("2")
jbib = journal_discontinued_to_found_2.bibjson()
jbib.title = "Discontinued Tomorrow 2"
jbib.discontinued_date = self._date_to_find()
journal_discontinued_to_found_2.save(blocking=True)

# that shouldn't be found
journal_discontinued_too_late = models.Journal(**JournalFixtureFactory.make_journal_source(in_doaj=True))
journal_discontinued_too_late.set_id("3")
jbib = journal_discontinued_too_late.bibjson()
jbib.title = "Discontinued In 2 days"
jbib.discontinued_date = self._date_too_late()
journal_discontinued_too_late.save(blocking=True)

job = find_discontinued_soon.FindDiscontinuedSoonBackgroundTask.prepare("system")
task = find_discontinued_soon.FindDiscontinuedSoonBackgroundTask(job)
task.run()

assert len(job.audit) == 3 # Journals 1 & 2, and a message to say notification is sent
assert job.audit[0]["message"] == Messages.DISCONTINUED_JOURNAL_FOUND_LOG.format(id="1")
assert job.audit[1]["message"] == Messages.DISCONTINUED_JOURNAL_FOUND_LOG.format(id="2")
assert job.audit[2]["message"] == Messages.DISCONTINUED_JOURNALS_FOUND_NOTIFICATION_SENT_LOG

def test_discontinued_soon_not_found(self):

# None of these should be found - this one discontinues in 2 days
journal_discontinued_too_late = models.Journal(**JournalFixtureFactory.make_journal_source(in_doaj=True))
journal_discontinued_too_late.set_id("1")
jbib = journal_discontinued_too_late.bibjson()
jbib.title = "Discontinued In 2 days"
jbib.discontinued_date = self._date_too_late()
journal_discontinued_too_late.save(blocking=True)

# this one is not in doaj
journal_not_in_doaj = models.Journal(**JournalFixtureFactory.make_journal_source(in_doaj=False))
journal_not_in_doaj.set_id("2")
jbib = journal_not_in_doaj.bibjson()
jbib.discontinued_date = self._date_to_find()
journal_not_in_doaj.save(blocking=True)

job = find_discontinued_soon.FindDiscontinuedSoonBackgroundTask.prepare("system")
task = find_discontinued_soon.FindDiscontinuedSoonBackgroundTask(job)
task.run()

assert len(job.audit) == 1
assert job.audit[0]["message"] == Messages.NO_DISCONTINUED_JOURNALS_FOUND_LOG
4 changes: 4 additions & 0 deletions portality/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ def form_diff_table_subject_expand(val):

return ", ".join(results)

@app.template_filter("is_in_the_past")
def is_in_the_past(dttm):
return dates.is_before(dttm, dates.today())


#######################################################

Expand Down
4 changes: 3 additions & 1 deletion portality/bll/services/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from portality.events.consumers.journal_editor_group_assigned_notify import JournalEditorGroupAssignedNotify
from portality.events.consumers.application_publisher_inprogress_notify import ApplicationPublisherInprogressNotify
from portality.events.consumers.update_request_publisher_rejected_notify import UpdateRequestPublisherRejectedNotify
from portality.events.consumers.journal_discontinuing_soon_notify import JournalDiscontinuingSoonNotify


class EventsService(object):
Expand All @@ -44,7 +45,8 @@ class EventsService(object):
JournalEditorGroupAssignedNotify,
UpdateRequestPublisherAcceptedNotify,
UpdateRequestPublisherAssignedNotify,
UpdateRequestPublisherRejectedNotify
UpdateRequestPublisherRejectedNotify,
JournalDiscontinuingSoonNotify
]

def __init__(self):
Expand Down
2 changes: 2 additions & 0 deletions portality/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@
EVENT_APPLICATION_EDITOR_GROUP_ASSIGNED = "application:editor_group:assigned"
EVENT_JOURNAL_ASSED_ASSIGNED = "journal:assed:assigned"
EVENT_JOURNAL_EDITOR_GROUP_ASSIGNED = "journal:editor_group:assigned"
EVENT_JOURNAL_DISCONTINUING_SOON = "journal:discontinuing_soon"

NOTIFICATION_CLASSIFICATION_STATUS = "alert"
NOTIFICATION_CLASSIFICATION_STATUS_CHANGE = "status_change"
NOTIFICATION_CLASSIFICATION_ASSIGN = "assign"
NOTIFICATION_CLASSIFICATION_CREATE = "create"
Expand Down
Loading

0 comments on commit 7626ffe

Please sign in to comment.