Skip to content

Commit 55fc0a2

Browse files
authored
Merge pull request #560 from yacchin1205/fix/gw-issue-2024-12-rcos-release
[GRDM-47278, 47805] GW連携に関する修正のRCOS環境への反映
2 parents 1c07bee + 7e1d003 commit 55fc0a2

File tree

6 files changed

+40
-7
lines changed

6 files changed

+40
-7
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ RUN set -ex \
9999
/code/addons/*/requirements.txt \
100100
/code/admin/rdm*/requirements.txt \
101101
; do \
102-
pip3 install --no-cache-dir -r "$reqs_file" \
102+
pip3 install --no-cache-dir -r "$reqs_file" || exit 1 \
103103
; done \
104104
&& (pip3 uninstall uritemplate.py --yes || true) \
105105
&& pip3 install --no-cache-dir uritemplate.py==0.3.0 \

addons/weko/deposit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def deposit_metadata(
120120
zip_path = os.path.join(tmp_dir, 'payload.zip')
121121
with ZipFile(zip_path, 'w') as zf:
122122
for download_file_name, _ in download_file_names:
123-
with zf.open(os.path.join('data/', download_file_name), 'w') as df:
123+
with zf.open(f'data/files/{download_file_name}', 'w') as df:
124124
with open(download_file_path, 'rb') as sf:
125125
shutil.copyfileobj(sf, df)
126126
with zf.open('data/index.csv', 'w') as f:

addons/weko/mappings/e-rad-metadata-mappings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@projects": {
2222
"@type": "object",
2323
"metadata.item_30002_funding_reference21[]": {
24-
"subitem_funder_identifier": {
24+
"subitem_funder_identifiers": {
2525
"@createIf": "{{ funder_value }}",
2626
"subitem_funder_identifier_type": "e-Rad_funder"
2727
},
@@ -50,7 +50,7 @@
5050
"subitem_funding_stream": "{{program_name_en_value}}",
5151
"subitem_funding_stream_language": "en"
5252
},
53-
"subitem_award_number": {
53+
"subitem_award_numbers": {
5454
"@createIf": "{{ japan_grant_number_value }}",
5555
"subitem_award_number_type": "JGN",
5656
"subitem_award_number": "{{japan_grant_number_value}}"

addons/weko/schema.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@
2525

2626
def _generate_file_columns(index, download_file_name, download_file_type):
2727
columns = []
28-
columns.append((f'.file_path[{index}]', f'.ファイルパス[{index}]', '', 'Allow Multiple', download_file_name))
28+
columns.append((
29+
f'.file_path[{index}]',
30+
f'.ファイルパス[{index}]',
31+
'',
32+
'Allow Multiple',
33+
f'files/{download_file_name}'
34+
))
2935
return columns
3036

3137
def _get_metadata_value(file_metadata_data, item, lang, index):

addons/weko/tests/test_schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_write_csv_minimal(self):
9696
)
9797
assert_equal(
9898
props.pop(),
99-
['.file_path[0]', '.ファイルパス[0]', '', 'Allow Multiple', 'test.jpg'],
99+
['.file_path[0]', '.ファイルパス[0]', '', 'Allow Multiple', 'files/test.jpg'],
100100
)
101101
feedback_mail = props.pop()
102102
assert_equal(
@@ -281,7 +281,7 @@ def test_write_csv_full(self):
281281
)
282282
assert_equal(
283283
props.pop(),
284-
['.file_path[0]', '.ファイルパス[0]', '', 'Allow Multiple', 'test.jpg'],
284+
['.file_path[0]', '.ファイルパス[0]', '', 'Allow Multiple', 'files/test.jpg'],
285285
)
286286
feedback_mail = props.pop()
287287
assert_equal(
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.11.28 on 2024-11-07 22:16
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations
6+
7+
8+
def ensure_registration_mappings(*args):
9+
from api.base import settings
10+
from addons.weko.apps import NAME
11+
from addons.weko.utils import ensure_registration_metadata_mapping
12+
from addons.weko.mappings import REGISTRATION_METADATA_MAPPINGS
13+
if NAME not in settings.INSTALLED_APPS:
14+
return
15+
for schema_name, mappings in REGISTRATION_METADATA_MAPPINGS:
16+
ensure_registration_metadata_mapping(schema_name, mappings)
17+
18+
19+
class Migration(migrations.Migration):
20+
21+
dependencies = [
22+
('osf', '0242_ensure_schema_mappings'),
23+
]
24+
25+
operations = [
26+
migrations.RunPython(ensure_registration_mappings, ensure_registration_mappings),
27+
]

0 commit comments

Comments
 (0)