❔ SOLVER Ordering messages based on the receiver or sender last message
I have this piece of code
What this does its that it gets a list of Users which meet a certain criteria.
I have managed to order them based on the last message that they sent me, and it works pretty well. However, I am unable to order them based on the last message that I (receiver) sent them. It wont get updated
16 Replies
This is an example of the functionality so far, as you can see. When another user (sender) sends a message, their icon goes up.
As you can see, at the beggining it all works fine, new messages from sender, their profiles go up.
But when the receiver sends a message, it does not make the icon go up
I need to order the users based on the last message of either the sender or receiver, and currently its only getting ordered based on the senders last message
I suspect the issue might be inside this select
For reference, this is the MessageJoinQuery
is this a practice/test application? because to me looks like this queries when you have upwards of thousands messages would probably slow down a bit
also it's a bit unclear to me what's happening in the video
why does the left window have the icons and the right one doesn't? is it a room?
kind of a practice application
im creating a table called messages where i pretty much store all the messages, which you are right, might store thousands and thousands of messages which might be slow
This is pretty much it
the left window has icons because its the actual users chat, in their profile. similar to facebook messenger chat, the second one does not have icons because its just another user visiting someone elses profile and opening a chat and sending them a message
ok, so next the
.Where(u => u.Receiver_Username == username)
kinda seems limiting your query based on the logic you described
if that's the method that does all the work and there aren't other queriesyep, something i tried was doing the .Where like this
.Where(m => m.Receiver_Username == username || m.Sender_Username == username)
This selected all the messages of a certain conversation, pretty much.
Then grouping them like this
.GroupBy(m => new { m.Sender_Username, m.Receiver_Username })
And this ordered them almost the way I wanted to, however, the result was having the sender icons in the final result
So I kinda wanted to do this, get sender and receiver messages, group them together, order them based on the timestamp of the message, and then remove the sender messages.
But this code didnt return anything
Do you know if there is a way to add a breakpoint on every like line of code on that link query without having to materialize the query/ save it into memory?
put breakpoints and debug like this would take a lot of time because it would make you step through every item
what i would do is separate the query sort of for every line
like
and then look at the result for every operation if it corresponds to what i think is happening
using the table view it shouldn't be a long process
that pretty much saves it into memory, its a good way. Ill do it like that
Btw, I fixed it
This was the final result
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.