If each student can take the test multiple times (attempts), then we have a 1 to N relationship between students and attempts.
Therefore, in that case the student_id goes in the attempts table.
Since there is no way for several students to make the same attempt (but the same evaluation), then we can ensure the relationship 1 to N.
In that graph you show, however, there are many relationships that are not understood.
An assessment is supposed to be unique, and not related to any student. It could be related to a subject. Therefore, there are illogical relationships within what you show.
IMPORTANT NOTE
It is important to understand that relationships in a database are given by business rules. There is no single way to make relationships without knowing precisely the rules of that business. One can guess how it should be, but without knowing if, for example, the student can make more than one attempt, it is impossible to know if the model is indeed correct or not.
Does the user_id have to be in the Attempt entity? My answer is yes.
A user has multiple attempts and each attempt belongs to a user . Also, each attempt belongs to an assessment and assessments can be attempted multiple times.
[user]-1-N->[attempt]<-N-1-[evaluation]
Therefore, the intent must contain the user_id and the id of the evaluation to which it belongs.
Therefore, the evaluation should not have another relationship with the user, the "attempt" is the only intermediary that is needed between the two. I advise you to try to avoid any type of circular relationship or you could have several problems when implementing them.
Another thing to consider is the types of the attributes. If the evaluation_id is type "serial" it should be reflected in the same way in the "attempt" table, the same for the user_id.
What kind of relationship do we find here?
If each student can take the test multiple times (attempts), then we have a 1 to N relationship between students and attempts.
Therefore, in that case the student_id goes in the attempts table.
Since there is no way for several students to make the same attempt (but the same evaluation), then we can ensure the relationship 1 to N.
In that graph you show, however, there are many relationships that are not understood.
An assessment is supposed to be unique, and not related to any student. It could be related to a subject. Therefore, there are illogical relationships within what you show.
IMPORTANT NOTE
It is important to understand that relationships in a database are given by business rules. There is no single way to make relationships without knowing precisely the rules of that business. One can guess how it should be, but without knowing if, for example, the student can make more than one attempt, it is impossible to know if the model is indeed correct or not.
Does the user_id have to be in the Attempt entity? My answer is yes.
A user has multiple attempts and each attempt belongs to a user . Also, each attempt belongs to an assessment and assessments can be attempted multiple times.
Therefore, the intent must contain the user_id and the id of the evaluation to which it belongs.
Therefore, the evaluation should not have another relationship with the user, the "attempt" is the only intermediary that is needed between the two. I advise you to try to avoid any type of circular relationship or you could have several problems when implementing them.
Another thing to consider is the types of the attributes. If the evaluation_id is type "serial" it should be reflected in the same way in the "attempt" table, the same for the user_id.