Skip to content

Commit bb74bc0

Browse files
authored
Merge pull request #189 from ibrahemomari/manuallly-sorting
Fix: fix manually sorting in the People plugin is not working as expe…
2 parents ff49804 + 328bada commit bb74bc0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

control/content/js/aiStateSeederManager.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const aiStateSeederManager = {
1111
bodyContent: '',
1212
position: '',
1313
email: '',
14+
rank: 0,
1415
},
1516
],
1617
init() {
@@ -39,7 +40,7 @@ const aiStateSeederManager = {
3940
userMessage:
4041
'Generate a sample list of contacts for people working in the field of [business-type]',
4142
systemMessage:
42-
'Each contact should have a first name, last name, phone number, avatar in png format, bio, position, and email. Use https://avatars.dicebear.com/api/avataaars/ to generate useable avatar URLs, bio as HTML content, and for first name and last name use gender-neutral names',
43+
'Each contact should have a first name, last name, phone number, avatar in png format, bio, position, rank is item order number starting from zero, and email. Use https://avatars.dicebear.com/api/avataaars/ to generate useable avatar URLs, bio as HTML content, and for first name and last name use gender-neutral names, rank must be type number',
4344
jsonTemplate: this.jsonTemplate,
4445
callback: this._handleGenerate.bind(this),
4546
},
@@ -178,7 +179,7 @@ const aiStateSeederManager = {
178179

179180
_applyDefaults(list) {
180181
return list
181-
.map((item) => {
182+
.map((item, idx) => {
182183
item.location = item.location || 'N/A';
183184
item.description = item.description || 'N/A';
184185
item.fName = item.fName || 'N/A';
@@ -188,6 +189,7 @@ const aiStateSeederManager = {
188189
item.bodyContent = item.bodyContent || 'N/A';
189190
item.position = item.position || 'N/A';
190191
item.email = item.email || 'N/A';
192+
item.rank = item.rank || 999 + idx;
191193
return item;
192194
});
193195
},

widget/controllers/widget.home.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@
401401
initCarousel(images);
402402
}
403403
if (event && event.data && event.data.content && event.data.content.sortBy && currentSortOrder != event.data.content.sortBy) {
404+
currentSortOrder = event.data.content.sortBy;
404405
WidgetHome.data.content.sortBy = event.data.content.sortBy;
405406
WidgetHome.items = [];
406407
searchOptions.skip = 0;

0 commit comments

Comments
 (0)