Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Literature-services
public-projects
xpub-epmc
Commits
b77c2046
Commit
b77c2046
authored
Oct 20, 2021
by
Audrey Hamelers
Browse files
#1233
parent
761cb01e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
26 deletions
+35
-26
server/ebi-integration/grantLinkCheck.js
server/ebi-integration/grantLinkCheck.js
+1
-0
server/ebi-integration/linkGrants.js
server/ebi-integration/linkGrants.js
+16
-12
server/email/templates/grantsAdded.js
server/email/templates/grantsAdded.js
+18
-14
No files found.
server/ebi-integration/grantLinkCheck.js
View file @
b77c2046
...
...
@@ -59,6 +59,7 @@ async function grantLinkCheck() {
}
await
linkingManuscripts
.
reduce
(
async
(
promise
,
m
)
=>
{
await
promise
delete
m
.
teams
m
.
fundingState
=
'
Grants linked
'
await
m
.
saveWithTrx
(
trx
)
return
Promise
.
resolve
()
...
...
server/ebi-integration/linkGrants.js
View file @
b77c2046
...
...
@@ -16,14 +16,14 @@ module.exports.createGrantLinks = async function createGrantLinks(
}
.
${
moment
().
format
(
'
YYYY_MM_DD-HH_mm_SS
'
)}
.xml`
const
sendManuscripts
=
manuscripts
.
reduce
((
list
,
manuscript
)
=>
{
const
articleIds
=
manuscript
[
'
meta,article
_i
ds
'
]
&&
manuscript
[
'
meta,article
_i
ds
'
]
manuscript
[
'
meta,article
I
ds
'
]
&&
manuscript
[
'
meta,article
I
ds
'
]
.
filter
(
a
=>
[
'
pmcid
'
,
'
pmid
'
].
includes
(
a
.
pubIdType
))
.
sort
((
a
,
b
)
=>
(
a
.
pubIdType
>
b
.
pubIdType
?
1
:
-
1
))
const
fundingGroup
=
(
manuscript
[
'
meta,funding
_g
roup
'
]
&&
manuscript
[
'
meta,funding
_g
roup
'
].
length
>
0
&&
manuscript
[
'
meta,funding
_g
roup
'
])
||
(
manuscript
[
'
meta,funding
G
roup
'
]
&&
manuscript
[
'
meta,funding
G
roup
'
].
length
>
0
&&
manuscript
[
'
meta,funding
G
roup
'
])
||
undefined
if
(
articleIds
&&
...
...
@@ -118,13 +118,15 @@ function sendXML(contents, filename) {
}
async
function
emailGrantPis
(
manuscript
,
grantList
)
{
const
{
teams
,
id
}
=
manuscript
const
releaseDelay
=
manuscript
[
'
meta,release
_d
elay
'
]
const
{
teams
,
id
,
status
}
=
manuscript
const
releaseDelay
=
manuscript
[
'
meta,release
D
elay
'
]
const
title
=
manuscript
[
'
meta,title
'
]
const
fundingGroup
=
manuscript
[
'
meta,funding
_g
roup
'
]
const
fundingGroup
=
manuscript
[
'
meta,funding
G
roup
'
]
const
emails
=
teams
.
map
(
t
=>
t
.
users
[
0
].
identities
[
0
].
email
)
const
{
teamMembers
:
rTeam
}
=
teams
.
find
(
t
=>
t
.
role
===
'
reviewer
'
)
||
{}
const
[
reviewer
]
=
rTeam
||
[]
const
{
users
}
=
teams
.
find
(
t
=>
t
.
roleName
===
'
reviewer
'
)
||
teams
.
find
(
t
=>
t
.
roleName
===
'
submitter
'
)
const
[
user
]
=
users
if
(
!
fundingGroup
||
fundingGroup
.
length
===
0
)
return
true
if
(
fundingGroup
.
some
(
g
=>
emails
.
includes
(
g
.
pi
.
email
)))
return
true
...
...
@@ -149,10 +151,12 @@ async function emailGrantPis(manuscript, grantList) {
id
,
title
,
releaseDelay
,
status
,
}
const
reviewerName
=
reviewer
&&
reviewer
.
alias
.
name
const
{
givenNames
,
surname
}
=
user
const
linkName
=
{
givenNames
,
surname
}
await
Promise
.
all
(
piList
.
map
(
async
li
=>
grantEmail
(
li
.
pi
,
li
.
awards
,
manInfo
,
reviewer
Name
)),
piList
.
map
(
async
li
=>
grantEmail
(
li
.
pi
,
li
.
awards
,
manInfo
,
link
Name
)),
)
return
true
}
server/email/templates/grantsAdded.js
View file @
b77c2046
const
grantsAddedTemplate
=
(
pi
,
grants
,
manInfo
,
review
er
)
=>
`
const
grantsAddedTemplate
=
(
pi
,
grants
,
manInfo
,
us
er
)
=>
`
<p>Dear
${
pi
.
title
?
`
${
pi
.
title
}
`
:
''
}${
pi
.
givenNames
?
`
${
pi
.
givenNames
}
`
:
''
}${
pi
.
surname
}
,</p>
<p>This message is to inform you that your grant
${
grants
.
length
>
1
?
'
s
'
:
''
}
, listed below, ha
${
grants
.
length
>
1
?
'
v
e
'
:
'
s
'
}
been linked to a paper deposited with
Europe PMC plus:<p>
}
, listed below, ha
${
grants
.
length
>
1
?
'
ve
'
:
'
s
'
}
been linked to a paper
${
manInfo
.
status
===
'
link-existing
'
?
'
v
ia
'
:
'
deposited with
'
}
Europe PMC plus:<p>
<ul>
${
grants
.
map
(
g
=>
`<li>
${
g
.
fundingSource
}
${
g
.
awardId
}
, <em>
${
g
.
title
}
</em></li>`
)
.
join
(
''
)}
</ul>
<p>The linked paper is <em>
${
manInfo
.
title
}
</em> (
${
manInfo
.
id
}
), under the review of
${
reviewer
.
givenNames
}
${
reviewer
.
surname
}
.</p>
<p>If you are satisfied that this link has been made correctly, no further action is required. The paper will be uploaded to Europe PMC
${
<p>The linked paper is <em>
${
manInfo
.
title
}
</em> (
${
manInfo
.
id
}
), linked by
${
user
.
givenNames
}
${
user
.
surname
}
.</p>
<p>If you are satisfied that this link has been made correctly, no further action is required.
${
manInfo
.
status
===
'
link-existing
'
?
'
</p>
'
:
`The paper will be uploaded to Europe PMC
${
manInfo
.
releaseDelay
===
'
0
'
?
'
immediately
'
:
`
${
manInfo
.
releaseDelay
}
month
${
manInfo
.
releaseDelay
===
'
1
'
?
''
:
'
s
'
}
`
}
after publication.</p>
}
after publication.</p>`
}
<p>If you have any questions, or think this link has been made in error, please respond to this message for assistance.</p>
<p>Sincerely,</p>
<p>The Europe PMC Helpdesk</p>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment