Skip to content

Commit f0cb77c

Browse files
committed
Address code review feedback
1 parent cf4d71a commit f0cb77c

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

app/models/normalize_timdex_record.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def normalize
1515
'format' => format,
1616
'links' => links,
1717
'citation' => citation,
18-
'identifier' => record_id,
18+
'identifier' => identifier,
1919
'summary' => summary,
2020
'publisher' => publisher,
2121
'location' => location,
@@ -45,7 +45,9 @@ def creators
4545
end
4646

4747
def source
48-
@record['source']&.first || 'Unknown source'
48+
return 'Unknown source' unless @record['source']
49+
50+
@record['source']
4951
end
5052

5153
def year
@@ -113,7 +115,7 @@ def subjects
113115
@record['subjects'].map { |subject| subject['value'] }
114116
end
115117

116-
def record_id
118+
def identifier
117119
@record['timdexRecordId']
118120
end
119121

app/views/search/_result_geo.html.erb

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
<li class="result">
22
<div class="result-content">
33
<h3 class="record-title">
4-
<span class="sr">Title: </span><%= link_to(result_geo['title'], record_path(result_geo['timdex_record_id'])) %>
4+
<span class="sr">Title: </span><%= link_to(result_geo['title'], record_path(result_geo['identifier'])) %>
55
</h3>
66

7-
<% if result_geo['content_type'] || result_geo['dates'] %>
8-
<div class="data-info">
9-
<%= render partial: 'shared/geo_data_info', locals: {
10-
metadata: {
11-
'contentType' => result_geo['content_type'],
12-
'dates' => result_geo['dates']
13-
}
14-
} %>
15-
</div>
16-
<% end %>
7+
<div class="data-info">
8+
<%= render partial: 'shared/geo_data_info', locals: { metadata: result_geo } %>
9+
</div>
1710

1811
<% if result_geo['creators'].present? || result_geo['contributors'].present? %>
1912
<span class="sr">Contributors: </span>
@@ -39,7 +32,7 @@
3932
<% end %>
4033

4134
<div class="result-record">
42-
<%= view_record(result_geo['timdex_record_id']) %>
35+
<%= view_record(result_geo['identifier']) %>
4336
</div>
4437
</div>
4538
</li>

app/views/shared/_geo_data_info.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
<% elsif access_type(metadata) == 'MIT authentication required' %>
1212
<li><span class="access-restricted"><%= access_type(metadata) %></span></li>
1313
<% end %>
14-
</ul>
14+
</ul>

test/fixtures/timdex/full_record.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"timdexRecordId": "test-record-123",
33
"title": "Sample TIMDEX Record for Testing",
4-
"source": ["Test Repository"],
4+
"source": "Test Repository",
55
"contentType": [
66
{"value": "Dataset"},
77
{"value": "Geospatial data"}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"timdexRecordId": "minimal-record-456",
33
"title": "Minimal Test Record",
4-
"source": ["Test Repository"]
4+
"source": "Test Repository"
55
}

0 commit comments

Comments
 (0)