Commit f6b3a084 authored by Scott Hampton's avatar Scott Hampton

Move recent_failures to computed prop

To abstract away from repeatedly accessing an
object's property, we'll add that property to a
computed prop so if we ever change that
property name it's just one spot that we need
to update.
parent 875dd6b7
...@@ -24,7 +24,7 @@ export default { ...@@ -24,7 +24,7 @@ export default {
}, },
computed: { computed: {
failureHistoryMessage() { failureHistoryMessage() {
if (!this.testCase.recent_failures) { if (!this.hasRecentFailures) {
return null; return null;
} }
...@@ -32,14 +32,20 @@ export default { ...@@ -32,14 +32,20 @@ export default {
n__( n__(
'Reports|Failed %{count} time in %{baseBranch} in the last 14 days', 'Reports|Failed %{count} time in %{baseBranch} in the last 14 days',
'Reports|Failed %{count} times in %{baseBranch} in the last 14 days', 'Reports|Failed %{count} times in %{baseBranch} in the last 14 days',
this.testCase.recent_failures.count, this.recentFailures.count,
), ),
{ {
count: this.testCase.recent_failures.count, count: this.recentFailures.count,
baseBranch: this.testCase.recent_failures.base_branch, baseBranch: this.recentFailures.base_branch,
}, },
); );
}, },
hasRecentFailures() {
return Boolean(this.recentFailures);
},
recentFailures() {
return this.testCase.recent_failures;
},
}, },
text: { text: {
name: __('Name'), name: __('Name'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment