Update mentorship area of user internal view (#926)

* Update mentorship area of user internal view

* Update mentorship backend
This commit is contained in:
Ben Halpern 2018-10-15 18:04:29 -04:00 committed by GitHub
parent e881cf5e7c
commit dee58c0dce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,7 +62,7 @@
</ul>
<% else %>
<em>This member does not have any mentorship relationships right now.</em>
</br>
<br />
<% end %>
<br>
<%= f.label :add_mentor %>
@ -101,14 +101,17 @@
</div>
<% if @user.seeking_mentorship %>
<h2> Mentee Description </h2>
<p style="position:sticky;top:50px;background:white;z-index:1000;padding:10px"><%= @user.mentee_description %></p>
<h2> Possible Mentors </h2>
<% count = 0 %>
<% User.where(offering_mentorship: true).order("mentor_form_updated_at DESC").each do |possible_mentor| %>
<% break if count > 18 %>
<% User.where(offering_mentorship: true).where.not(mentor_form_updated_at: nil).order("mentor_form_updated_at DESC").each do |possible_mentor| %>
<% break if count > 20 %>
<% count = count + 1 %>
<% tag_intersection = ( @user.cached_followed_tag_names & possible_mentor.cached_followed_tag_names ) %>
<% mentor_relationships_count = MentorRelationship.where(mentor_id: possible_mentor.id).size %>
<% if tag_intersection.any? && mentor_relationships_count < 2 %>
<% if tag_intersection.any? && mentor_relationships_count < 1 %>
<div class="row">
<div class="col-md-2">
<h4>User</h4>