Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show author names next to final result in author merge tool #10297

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions openlibrary/components/MergeUI/MergeTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
:ratings="ratings"
:class="{ selected: selected[record.key]}"
:cellSelected="isCellUsed"
:merged="merge ? merge.record : null"
:merged="enhancedMergedRecordOnly"
:show_diffs="show_diffs"
>
<template #pre>
Expand All @@ -31,7 +31,7 @@
</MergeRow>
</tbody>
<tfoot>
<MergeRow v-if="merge" :record="merge.record" :selected="selected" :fields="fields" :merged="merge">
<MergeRow v-if="enhancedMergedRecordOnly" :record="enhancedMergedRecordOnly" :selected="selected" :fields="fields" :merged="merge">
<template #pre>
<td />
</template>
Expand Down Expand Up @@ -220,6 +220,24 @@ export default {
.map(r => r.key);

return { record, sources, ...extras, dupes, editions_to_move, unmergeable_works };
},
async enhancedMergedRecordOnly() {
if (!this.merge?.record) return null;

let author_names;

try {
author_names = await get_author_names([this.merge.record]);
} catch (error) {
console.error('Error creating enhancedMergedRecordOnly:', error);
}

const enhanced_merge = _.cloneDeep(this.merge.record);

for (const entry of (enhanced_merge.authors || [])) {
entry.name = author_names[entry.author.key.slice('/authors/'.length)];
}
return enhanced_merge;
}
},
methods: {
Expand Down