|
4 | 4 | <NavBar v-bind:currentRoute="'History'"></NavBar> |
5 | 5 | <section class="mx-auto"> |
6 | 6 | <HistoryRecommendations |
| 7 | + v-if="firstTimeAnalysisDone" |
7 | 8 | v-bind:ready="recommendationsAnalysisDone" |
8 | 9 | v-on:update-history="updateHistory" |
9 | 10 | v-bind:title="'Potential matches'" |
@@ -44,15 +45,12 @@ export default { |
44 | 45 | interests: [], |
45 | 46 | }, |
46 | 47 | recommendationsAnalysisDone: false, |
| 48 | + firstTimeAnalysisDone: false, |
47 | 49 | }), |
48 | 50 | methods: { |
49 | 51 | async fetchUsers() { |
50 | | - if (this.recommendationsFromSettingUp) { |
51 | | - this.recommendations = this.recommendationsFromSettingUp; |
52 | | - } else { |
53 | | - const recommendationsRequest = await this.$http.get('/recommendations'); |
54 | | - this.recommendations = recommendationsRequest.data.recommendations; |
55 | | - } |
| 52 | + const recommendationsRequest = await this.$http.get('/recommendations'); |
| 53 | + this.recommendations = recommendationsRequest.data.recommendations; |
56 | 54 | this.recommendations.sort((a, b) => a.distance - b.distance); |
57 | 55 | for (let i = 0; i < this.recommendations.length; i += 1) { |
58 | 56 | this.recommendations[i].distance = Math.floor(this.recommendations[i].distance); |
@@ -87,6 +85,7 @@ export default { |
87 | 85 | } |
88 | 86 | } |
89 | 87 | this.recommendationsAnalysisDone = true; |
| 88 | + this.firstTimeAnalysisDone = true; |
90 | 89 | }, |
91 | 90 | browseAgain() { |
92 | 91 | this.recommendations = []; |
@@ -121,6 +120,7 @@ export default { |
121 | 120 | }, |
122 | 121 | deactivated() { |
123 | 122 | if (!this.$route.path.startsWith('/users')) { |
| 123 | + this.firstTimeAnalysisDone = false; |
124 | 124 | this.browseAgain(); |
125 | 125 | this.fetchUsers(); |
126 | 126 | this.$el.scrollTop = 0; |
|
0 commit comments