diff --git a/src/components/modules/lists/ItemLabel.vue b/src/components/modules/lists/ItemLabel.vue
index 906934e84..4080bbd81 100644
--- a/src/components/modules/lists/ItemLabel.vue
+++ b/src/components/modules/lists/ItemLabel.vue
@@ -104,7 +104,7 @@ export default {
? this.$tc('numbers.clusterSize', item.clusterSize, {
n: this.$n(item.clusterSize)
})
- : ''
+ : 'size'
const lexicalOverlapLabel =
item.lexicalOverlap != null
? this.$tc('numbers.lexicalOverlap', item.lexicalOverlap, {
@@ -134,7 +134,7 @@ export default {
return this.$t('textReuseClusterSummary', {
shortId: item.shortId,
textSampleExcerpt: item.textSampleExcerpt,
- clusterSize: clusterSizeLabel,
+ size: clusterSizeLabel,
lexicalOverlap: lexicalOverlapLabel,
timespan: this.$tc('numbers.days', item.timeDifferenceDay, {
n: item.timeDifferenceDay
@@ -162,7 +162,7 @@ export default {
"numbers": {
"days": "the same day|over {n} day|over {n} days"
},
- "textReuseClusterSummary": "cluster {shortId}
{textSampleExcerpt}" + "textReuseClusterSummary": "cluster {shortId} ({size})
{textSampleExcerpt}" } } diff --git a/src/models/TextReuseCluster.js b/src/models/TextReuseCluster.js index 931a3f429..74edf36f8 100644 --- a/src/models/TextReuseCluster.js +++ b/src/models/TextReuseCluster.js @@ -27,7 +27,7 @@ export default class TextReuseCluster { minDate = new Date(), clusterSize = 0, lexicalOverlap = 0, - connectedClusters = [], + connectedClusters = [] } = {}) { this.id = String(id) this.shortId = this.id.split('-').pop() @@ -37,9 +37,18 @@ export default class TextReuseCluster { this.textSampleContent = String(textSampleContent) this.textSampleExcerpt = String(textSampleExcerpt) this.textSampleDate = String(textSampleDate) - this.timeDifferenceDay = parseInt(timeDifferenceDay, 10) this.maxDate = maxDate this.minDate = minDate + // recalculate timedifferencedya using dates + const computedTimeDifferenceDay = Math.floor( + (this.maxDate - this.minDate) / (24 * 60 * 60 * 1000) + ) + if (computedTimeDifferenceDay !== timeDifferenceDay) { + console.warn('recalculating timeDifferenceDay', this.timeDifferenceDay, timeDifferenceDay) + this.timeDifferenceDay = computedTimeDifferenceDay + } else { + this.timeDifferenceDay = timeDifferenceDay + } this.clusterSize = parseInt(clusterSize, 10) this.connectedClusters = connectedClusters this.lexicalOverlap = parseFloat(lexicalOverlap) @@ -48,7 +57,7 @@ export default class TextReuseCluster { static fromSolrResponse(response) { return response.map(cluster => { return new TextReuseCluster({ - id: cluster.id, + id: cluster.id }) }) } @@ -62,7 +71,7 @@ export default class TextReuseCluster { const maxDate = new Date(item.date) const minDate = new Date( - +maxDate - item.textReuseCluster.timeDifferenceDay * 24 * 60 * 60 * 1000, + +maxDate - item.textReuseCluster.timeDifferenceDay * 24 * 60 * 60 * 1000 ) return new TextReuseCluster({ id: item.textReuseCluster.id, @@ -77,7 +86,7 @@ export default class TextReuseCluster { minDate, clusterSize: item.textReuseCluster.clusterSize, lexicalOverlap: item.textReuseCluster.lexicalOverlap, - connectedClusters: item.connectedClusters, + connectedClusters: item.connectedClusters }) } }