Your other option if you really need to pull that array of ID’s is to use the currently loggeg in member id and check if that ID exists in your returned array.
If yes, send the logged in member id
If no, do nothing
You can you this by using array includes…something like this
arrayOfIds.includes(loggedInMemberId);
@amandam I’ll try it and get back to you!
You are really going above and beyond and I want to say to both you and Wix that you are AWESOME!
Truly, thanks!
@amandam I’ll try it and get back to you!
You are really going above and beyond and I want to say to both you and Wix that you are AWESOME!
Truly, thanks!
I’ll try this too, if needed!
@amandam Ok, I hesitate to say this again… but I got it!!! Using the console log to show results from the query was the key. The issue was that I had to define the loggedInMember._id as a variable, and use that variable in the query.
import { currentMember } from ‘wix-members’ ;
import { getMemberBadges , getVirtuosoBadge } from ‘backend/getBadges’
import wixData from ‘wix-data’
const options = {
fieldsets : [ ‘FULL’ ]
}
$w . onReady ( async function () {
$w ( '#myBadges' ). data = []
**const** loggedInMember = **await** currentMember . getMember ( options );
**const** memberBadges = **await** getMemberBadges ( loggedInMember . _id );
**const** currentMemberID = loggedInMember . _id
**if** ( memberBadges ) {
myBadges ( memberBadges )
}
wixData . query ( "Forum/Posts" )
. eq ( "_ownerId" , currentMemberID )
. gt ( "likeCount" , 10 )
. find ()
. then (( results ) => {
console . log ( results . items );
**if** ( results . items . length > 0 )
getVirtuosoBadge ( loggedInMember . _id );
});
Again… THANK YOU so much! I have learned a tremendous amount of coding from this tricky little excercise and I can use these new skills for so many things. Please feel free to send me your supervisor’s email so I can tell them how helpful and professional you were and are!
@percussionconservato I am so glad you were able to get through this and learn a lot for the future in the struggle. Debugging is one of the most critical skills you can learn as it helps illuminate problems that you can then focus on.
No need to message anyone! Supporting developers is part of my job. Happy coding!
@amandam Well you’re the best! Confirmed that the code is 100% rocking! Have a great week!