Skip to content

Commit b40492f

Browse files
authored
Merge branch 'skip-recommendation' of 'https://github.com/evamillan/grimoirelab-sortinghat'
Merges #939 Closes #939 Fixes #937
2 parents f508600 + 4570a03 commit b40492f

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Skip recommendations
3+
category: added
4+
author: Eva Millán <[email protected]>
5+
issue: 937
6+
notes: >
7+
Users can now skip a recommendation and review
8+
the next one if they are unsure of whether to
9+
apply it or dismiss it.

ui/src/components/Recommendations.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,14 @@
116116
{{ errorMessage }}
117117
</v-alert>
118118

119-
<v-card-actions class="pr-0 mt-4">
119+
<v-card-actions class="px-0 mt-4">
120+
<v-btn
121+
color="primary darken-1"
122+
variant="text"
123+
@click.prevent="fetchItem(page + 1)"
124+
>
125+
Skip
126+
</v-btn>
120127
<v-spacer></v-spacer>
121128
<v-btn
122129
color="primary darken-1"
@@ -158,6 +165,7 @@ export default {
158165
isOpen: false,
159166
errorMessage: null,
160167
menu: null,
168+
page: 1,
161169
};
162170
},
163171
methods: {
@@ -169,9 +177,12 @@ export default {
169177
this.$logger.error(`Error fetching recommendations: ${error}`);
170178
}
171179
},
172-
async fetchItem() {
180+
async fetchItem(page = 1) {
181+
if (this.currentItem && !this.currentItem.pageInfo.hasNext) {
182+
return this.onClose();
183+
}
173184
try {
174-
const response = await this.getRecommendations(1, 1);
185+
const response = await this.getRecommendations(page, 1);
175186
if (response.data.recommendedMerge.entities) {
176187
const recommendation = response.data.recommendedMerge.entities[0];
177188
this.currentItem = {
@@ -181,6 +192,7 @@ export default {
181192
pageInfo: response.data.recommendedMerge.pageInfo,
182193
};
183194
this.count = this.currentItem.pageInfo.totalResults;
195+
this.page = this.currentItem.pageInfo.page;
184196
}
185197
} catch (error) {
186198
this.errorMessage = this.$getErrorMessage(error);
@@ -199,7 +211,7 @@ export default {
199211
if (!this.currentItem.pageInfo.hasNext) {
200212
this.onClose();
201213
} else {
202-
this.fetchItem();
214+
this.fetchItem(this.page);
203215
}
204216
} catch (error) {
205217
this.errorMessage = this.$getErrorMessage(error);

0 commit comments

Comments
 (0)