diff --git a/jam-ui/cypress/e2e/friends/my-friends-page.cy.js b/jam-ui/cypress/e2e/friends/my-friends-page.cy.js index fe9e28ced..a97dbbab8 100644 --- a/jam-ui/cypress/e2e/friends/my-friends-page.cy.js +++ b/jam-ui/cypress/e2e/friends/my-friends-page.cy.js @@ -37,7 +37,7 @@ const closeSidePanel = () => { cy.get('[data-testid=profileSidePanel] .modal-header button.close').click(); }; -describe.only('Friends page without data', () => { +describe('Friends page without data', () => { beforeEach(() => { cy.stubAuthenticate(); // cy.intercept('POST', /\S+\/filter/, { diff --git a/jam-ui/src/components/page/JKMyFriends.js b/jam-ui/src/components/page/JKMyFriends.js index 977fb4fc9..1b7ca4da3 100644 --- a/jam-ui/src/components/page/JKMyFriends.js +++ b/jam-ui/src/components/page/JKMyFriends.js @@ -38,6 +38,7 @@ export const JKMyFriends = () => { .then(async response => { const data = await response.json(); const friendIds = data.map(friend => friend.id); + console.log('friendIds', friendIds); //fetch friends with associated data dispatch(filterFriendsByIds({ userId: currentUser.id, ids: friendIds })); //fetch latencies for friends diff --git a/jam-ui/src/components/page/JKPeopleFilter.js b/jam-ui/src/components/page/JKPeopleFilter.js index e4f13b7b7..c7ba885da 100644 --- a/jam-ui/src/components/page/JKPeopleFilter.js +++ b/jam-ui/src/components/page/JKPeopleFilter.js @@ -151,6 +151,7 @@ function JKPeopleFilter() { }; const onSubmit = (data) => { + console.log("_DEBUG_ data", data) console.log("_DEBUG_ page.current", page.current) let genres = []; let joined_within_days = ''; diff --git a/jam-ui/src/components/profile/JKMessageModal.js b/jam-ui/src/components/profile/JKMessageModal.js index e304257b5..d947bf6bf 100644 --- a/jam-ui/src/components/profile/JKMessageModal.js +++ b/jam-ui/src/components/profile/JKMessageModal.js @@ -51,7 +51,7 @@ const JKMessageModal = props => { goToBottom(); } } catch (err) { - console.log('ERROR', err); + console.error('Error when fetching messages', err); } finally { setFetching(false); } @@ -100,32 +100,32 @@ const JKMessageModal = props => { useEffect(() => { if (scrollbar && scrollbar.current) { - if (!fetching && !scrollAtTop()) { - if (messages[messages.length - 1]['senderId'] !== currentUser.id) { - if (!scrolledToBottom.current) { + if (!fetching && !scrollAtTop()) { // if not data fetching and scroll is not at top + if (messages[messages.length - 1]['senderId'] !== currentUser.id) { // if last message is not sent by current user + if (!scrolledToBottom.current) { // if not scrolled to bottom setMessagesArrived(true); } else { - goToBottom(); + //goToBottom(); // a new message has arrived, scroll to bottom } } else { - goToBottom(); + //goToBottom(); } } } }, [messages]); - useEffect(() => { - if (!messagesArrived) { - setMessagesArrived(false); - goToBottom(); - } - }, [messagesArrived]); + // useEffect(() => { + // if (!messagesArrived) { + // setMessagesArrived(false); + // goToBottom(); + // } + // }, [messagesArrived]); const handleScrollStop = scrollValues => { scrolledToBottom.current = false; - if (scrollValues.scrollTop === 0) { + if (scrollValues.scrollTop === 0) { // if scrolled to top setOffset(prev => prev + 1); - } else if (scrollValues.scrollTop === scrollValues.scrollHeight - scrollValues.clientHeight) { + } else if (scrollValues.scrollTop === scrollValues.scrollHeight - scrollValues.clientHeight) { // if scrolled to bottom scrolledToBottom.current = true; setMessagesArrived(false); } @@ -152,7 +152,7 @@ const JKMessageModal = props => { { isIterableArray(messages) && messages.map((message, index) => (
-
+
diff --git a/ruby/lib/jam_ruby/lib/musician_filter.rb b/ruby/lib/jam_ruby/lib/musician_filter.rb index 1f300dff4..d30d16442 100644 --- a/ruby/lib/jam_ruby/lib/musician_filter.rb +++ b/ruby/lib/jam_ruby/lib/musician_filter.rb @@ -42,7 +42,7 @@ module JamRuby inst = [] instruments.each do |ii| proficiency_levels.each do |pl| - inst << { id: ii[:value], proficiency: pl} + inst << { instrument_id: ii[:value], proficiency_level: pl} end end filter_params.merge!(instruments: inst) @@ -85,7 +85,7 @@ module JamRuby raise exception end end - + def self.users_latency_data(user_obj, remote_ip, latency_good, latency_fair, latency_high, filter_opts, offset, limit) uri = URI(latency_url) begin diff --git a/ruby/lib/jam_ruby/models/base_search.rb b/ruby/lib/jam_ruby/models/base_search.rb index 7ba937f47..25b9e8366 100644 --- a/ruby/lib/jam_ruby/models/base_search.rb +++ b/ruby/lib/jam_ruby/models/base_search.rb @@ -180,8 +180,7 @@ module JamRuby end def _joined_within(rel) - #debugger - if 0 < (val = json[KEY_JOINED_WITHIN].to_i) + if json[KEY_JOINED_WITHIN].present? && 0 < (val = json[KEY_JOINED_WITHIN].to_i) rel = rel.where("users.created_at >= ?", val.days.ago.at_beginning_of_day) end rel diff --git a/ruby/lib/jam_ruby/models/musician_search.rb b/ruby/lib/jam_ruby/models/musician_search.rb index 31321066a..0a505a0fd 100644 --- a/ruby/lib/jam_ruby/models/musician_search.rb +++ b/ruby/lib/jam_ruby/models/musician_search.rb @@ -128,7 +128,7 @@ module JamRuby end def _active_within(rel) - if 0 <= (val = json[KEY_ACTIVE_WITHIN].to_i) + if json[KEY_ACTIVE_WITHIN].present? && 0 <= (val = json[KEY_ACTIVE_WITHIN].to_i) rel = rel.where("users.id IN (SELECT users.id FROM users GROUP BY id HAVING GREATEST(updated_at, last_jam_updated_at) >= ?)", val.days.ago.at_beginning_of_day) end rel @@ -163,6 +163,11 @@ module JamRuby def do_filter(user_ids) rel = User.musicians.where('users.id <> ?', self.user.id) + rel = self._genres(rel) + rel = self._instruments(rel) + rel = self._joined_within(rel) + rel = self._active_within(rel) + #user_ids: users returned from neo4j latency data service. #if this variable is not null, that means we are calling this method with neo4j latency data (currently this call only comes from api_search_controller#filter) #debugger