<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Slkwiatk</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Slkwiatk"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Slkwiatk"/>
	<updated>2026-09-15T18:58:54Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156614</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156614"/>
		<updated>2024-04-24T02:37:14Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Mailer Tests ===&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[File:Team_addition_fix.png | 600px]]&lt;br /&gt;
* Now head to an existing assignment that assigns mentors when team capacity is above 50%. Delete a team if there are no students left to be added to a team. Make sure there are mentors on the student list, if not, add at least 1. Count how many mentors and students will be added to teams when you create a team (in our case this will be 2 students and 1 mentor). &lt;br /&gt;
[[File:t_listz.png| 600px]]&lt;br /&gt;
* Auto-create teams with max participants. &lt;br /&gt;
[[File:cre_teams.png | 600px]]&lt;br /&gt;
* Wait a couple of minutes and then check the email address you entered in step 1. You should expect to receive x number of student emails, and y number of mentor emails, where x is the number of students just assigned to a team, and y is the number of mentors assigned to mentor a team. In our example below you can see that there are 2 distinct student emails, and 1 mentor email, which is as expected in our case. Don't forget to check your spam mail if you don't see the mail in your inbox after a few minutes. &lt;br /&gt;
[[File:email_case.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Email_case.png&amp;diff=156612</id>
		<title>File:Email case.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Email_case.png&amp;diff=156612"/>
		<updated>2024-04-24T02:35:59Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Cre_teams.png&amp;diff=156611</id>
		<title>File:Cre teams.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Cre_teams.png&amp;diff=156611"/>
		<updated>2024-04-24T02:35:46Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:T_listz.png&amp;diff=156610</id>
		<title>File:T listz.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:T_listz.png&amp;diff=156610"/>
		<updated>2024-04-24T02:35:35Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156609</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156609"/>
		<updated>2024-04-24T02:35:05Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[File:Team_addition_fix.png | 600px]]&lt;br /&gt;
* Now head to an existing assignment that assigns mentors when team capacity is above 50%. Delete a team if there are no students left to be added to a team. Make sure there are mentors on the student list, if not, add at least 1. Count how many mentors and students will be added to teams when you create a team (in our case this will be 2 students and 1 mentor). &lt;br /&gt;
[[File:t_listz.png| 600px]]&lt;br /&gt;
* Auto-create teams with max participants. &lt;br /&gt;
[[File:cre_teams.png | 600px]]&lt;br /&gt;
* Wait a couple of minutes and then check the email address you entered in step 1. You should expect to receive x number of student emails, and y number of mentor emails, where x is the number of students just assigned to a team, and y is the number of mentors assigned to mentor a team. In our example below you can see that there are 2 distinct student emails, and 1 mentor email, which is as expected in our case. Don't forget to check your spam mail if you don't see the mail in your inbox after a few minutes. &lt;br /&gt;
[[File:email_case.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156605</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156605"/>
		<updated>2024-04-24T02:32:57Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[File:Team_addition_fix.png | 600px]]&lt;br /&gt;
* Now head to an existing assignment that assigns mentors when team capacity is above 50%. Delete a team if there are no students left to be added to a team. Make sure there are mentors on the student list, if not, add at least 1. Count how many mentors and students will be added to teams when you create a team (in our case this will be 2 students and 1 mentor). &lt;br /&gt;
[[File:t_listz.png| 600px]]&lt;br /&gt;
* Auto-create teams with max participants. &lt;br /&gt;
[[File:cre_teams.png | 600px]]&lt;br /&gt;
* Wait a couple of minutes and then check the email address you entered in step 1. You should expect to receive x number of student emails, and y number of mentor emails, where x is the number of students just assigned to a team, and y is the number of mentors assigned to mentor a team. In our example below you can see that there are 2 distinct student emails, and 1 mentor email, which is as expected in our case. &lt;br /&gt;
[[File:email_case.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156603</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156603"/>
		<updated>2024-04-24T02:31:51Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[File:Team_addition_fix.png | 600px]]&lt;br /&gt;
* Now head to an existing assignment that assigns mentors when team capacity is above 50%. Delete a team if there are no students left to be added to a team. Make sure there are mentors on the student list, if not, add at least 1. Count how many mentors and students will be added to teams when you create a team (In our case this will be 2 students and 1 mentor). &lt;br /&gt;
[[File:t_listz.png| 600px]]&lt;br /&gt;
* Auto-create teams with max participants. &lt;br /&gt;
[[File:cre_teams.png | 600px]]&lt;br /&gt;
* Wait a couple of minutes and then check the email address you entered in step 1. You should expect to receive x number of student emails, and y number of mentor emails, where x is the number of students just assigned to a team, and y is the number of mentors assigned to mentor a team. In our example below you can see that there are 2 distinct student emails, and 1 mentor email, which is as expected in our case. &lt;br /&gt;
[[File:email_case.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156602</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156602"/>
		<updated>2024-04-24T02:31:22Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[File:Team_addition_fix | 600px]]&lt;br /&gt;
* Now head to an existing assignment that assigns mentors when team capacity is above 50%. Delete a team if there are no students left to be added to a team. Make sure there are mentors on the student list, if not, add at least 1. Count how many mentors and students will be added to teams when you create a team (In our case this will be 2 students and 1 mentor). &lt;br /&gt;
[[File:t_listz.png| 600px]]&lt;br /&gt;
* Auto-create teams with max participants. &lt;br /&gt;
[[File:cre_teams.png | 600px]]&lt;br /&gt;
* Wait a couple of minutes and then check the email address you entered in step 1. You should expect to receive x number of student emails, and y number of mentor emails, where x is the number of students just assigned to a team, and y is the number of mentors assigned to mentor a team. In our example below you can see that there are 2 distinct student emails, and 1 mentor email, which is as expected in our case. &lt;br /&gt;
[[File:email_case.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156560</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156560"/>
		<updated>2024-04-24T02:16:21Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent. &lt;br /&gt;
[[&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156559</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156559"/>
		<updated>2024-04-24T02:15:49Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Test Coverage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent.&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemented for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the test cases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Team_addition_fix.png&amp;diff=156547</id>
		<title>File:Team addition fix.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Team_addition_fix.png&amp;diff=156547"/>
		<updated>2024-04-24T02:13:41Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156544</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156544"/>
		<updated>2024-04-24T02:13:08Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Scenario 4 - Creating Team -&amp;gt; Recieve Emails */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Automatic Mentor Assignment ====&lt;br /&gt;
* We have added additional function to assign the mentor of the topic to be automatically assigned to the team that chooses the topic&lt;br /&gt;
[[File:Auto Assign Topic Mentor.png | 600px]]&lt;br /&gt;
* The signup_as_instructor_action function will automatically call the assignment function to add the topic's mentor to the team&lt;br /&gt;
[[File:Call_Assign_Mentor.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change line 45 of app/mailers/mailer from &amp;quot;defn[:to] = 'expertiza.mailer@gmail.com'&amp;quot; to &amp;quot;defn[:to] = '{Your Email}'&amp;quot;. This is so that you can test that the emails are being sent.&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156539</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156539"/>
		<updated>2024-04-24T02:10:32Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Manual UI Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Automatic topic mentor assignment changes ===&lt;br /&gt;
==== Team creation using decorator ====&lt;br /&gt;
* As we have moved the mentored team from a subclass of assignment team to being a decorator, we have modified the team creation code to assign the right type of class to the team&lt;br /&gt;
* If the team is a mentored team, we use the MentoredTeamDecorator to create the object of the Assignment class&lt;br /&gt;
[[File:Team Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Team deletion ====&lt;br /&gt;
* We have added the functionality to delete the Mentor meetings when the team is deleted&lt;br /&gt;
* If the team is a mentored team, we will find all the instances of mentor meetings for the team and delete them&lt;br /&gt;
* We have also modified the function to work as a independent function that can be called from any where in the application by passing a parameter&lt;br /&gt;
* When the parameter is not passed, it is used as a controller function to handle calls to a specific route&lt;br /&gt;
[[File:Team Deletion.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a user to a team ====&lt;br /&gt;
* We have modified the function to add an user to the team&lt;br /&gt;
* The create function in TeamsUsersController is modified&lt;br /&gt;
[[File:Team User Creation.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Form and table ====&lt;br /&gt;
* We have added a field in the topics form to add a mentor to the topic in &amp;lt;b&amp;gt;_topic.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Form.png | 600px]]&lt;br /&gt;
* The table displaying the topics is also modified to have a column for the mentors in &amp;lt;b&amp;gt;_table_header.html.erb&amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Header.png | 600px]]&lt;br /&gt;
* The topic row also displays the team members with the mentor included in it in the topics table in &amp;lt;b&amp;gt;_table_line.html.erb &amp;lt;/b&amp;gt;&lt;br /&gt;
[[File:Topic Row.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Adding a mentor to a topic - Functions ====&lt;br /&gt;
* We have modified the function to setup a new topic to include the functionality to add mentor to the topic&lt;br /&gt;
* In case we try to add a mentor who is not in the assignment or course, we add the mentor to the assignment and course too&lt;br /&gt;
* In this way we handle cases of adding mentors outside the course into the topic&lt;br /&gt;
[[File:Add Topic Mentor.png | 600px]]&lt;br /&gt;
* We have created some helper functions to assist in adding the mentor to the assignment and course&lt;br /&gt;
[[File:Addition Helpers.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 4 - Creating Team -&amp;gt; Recieve Emails ====&lt;br /&gt;
* Step 1 is to change the line&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156511</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156511"/>
		<updated>2024-04-24T01:58:10Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156508</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156508"/>
		<updated>2024-04-24T01:57:49Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Tests */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 5:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 6:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156506</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156506"/>
		<updated>2024-04-24T01:57:33Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Automated Rspec Testing  Scenarios */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
== Mailer Tests ==&lt;br /&gt;
5. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given a mentor is being added to a team, then the mailer should be called to send the mentor-specific mail to the mentor&lt;br /&gt;
  it 'sends mail to mentor if user is a mentor' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'mentor_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
6. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given a normal user is being added to a team, then the mailer should be called to send the general user addition mail to the user&lt;br /&gt;
  it 'sends mail to user if user is a user' do&lt;br /&gt;
          allow(MentorManagement).to receive(:user_a_mentor?).with(user).and_return(true)&lt;br /&gt;
          allow(Assignment).to receive(:find).with(1).and_return(assignment)&lt;br /&gt;
          allow(Mailer).to receive(:team_addition_message).and_return(double('Mail', deliver: true))&lt;br /&gt;
&lt;br /&gt;
          expect(Mailer).to receive(:team_addition_message).with(&lt;br /&gt;
            to: user.email,&lt;br /&gt;
            subject: '[Expertiza] Added to a Team',&lt;br /&gt;
            body: {&lt;br /&gt;
              user: user,&lt;br /&gt;
              first_name: ApplicationHelper.get_user_first_name(user),&lt;br /&gt;
              partial_name: 'user_added_to_team',&lt;br /&gt;
              team: team.name.to_s,&lt;br /&gt;
              assignment: ''&lt;br /&gt;
            }&lt;br /&gt;
          ).and_return(double('Mail', deliver: true))&lt;br /&gt;
          expect(team.add_member(user)).to be true&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156458</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156458"/>
		<updated>2024-04-24T01:45:49Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Team Add_Member */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156457</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156457"/>
		<updated>2024-04-24T01:45:34Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
*[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:New_Add_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:New_Add_Message.png&amp;diff=156456</id>
		<title>File:New Add Message.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:New_Add_Message.png&amp;diff=156456"/>
		<updated>2024-04-24T01:44:53Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156452</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156452"/>
		<updated>2024-04-24T01:41:32Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
* Additionally we removed the type check for whether a user is a participant or not, as most users should be participants. &lt;br /&gt;
*[[File:add_member_email.png | 600px]] ---&amp;gt; [[File:add_member_email.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156449</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156449"/>
		<updated>2024-04-24T01:39:05Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Team Add_Member */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly, we parameterized the partial_name in the call to the function that actually sends the mail, as in the original code we were violating the DRY principle by repeating the same MailerHelper call twice with very little change between them.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156444</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156444"/>
		<updated>2024-04-24T01:37:11Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Team Add_Member */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
* The add_member function was altered in a couple of different ways. Firstly,&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156442</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156442"/>
		<updated>2024-04-24T01:36:28Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
==== Team Add_Member ====&lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156436</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156436"/>
		<updated>2024-04-24T01:34:59Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* MailerHelper to Mailer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addtion_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156431</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156431"/>
		<updated>2024-04-24T01:34:14Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* MailerHelper to Mailer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addition_Message.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Team_Addtion_Message.png&amp;diff=156429</id>
		<title>File:Team Addtion Message.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Team_Addtion_Message.png&amp;diff=156429"/>
		<updated>2024-04-24T01:33:42Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156427</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156427"/>
		<updated>2024-04-24T01:33:15Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* MailerHelper to Mailer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 600px]] ---&amp;gt; [[File:Team_Addition_Message | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156422</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156422"/>
		<updated>2024-04-24T01:29:46Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
==== Decorator ====&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
==== MailerHelper to Mailer ====&lt;br /&gt;
* To increase understandability and consistency between classes, we removed the send_team_confirmation_mail function from the MailerHelper, and instead replaced its functionality with the team_addition_message function in the Mailer class. We found this to be the ideal location as the Mailer class houses many other specific message functions such as notify_grade_conflict_message, suggested_topic_approved_message and more. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156413</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156413"/>
		<updated>2024-04-24T01:17:20Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
* In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
* The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156412</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156412"/>
		<updated>2024-04-24T01:16:54Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
** In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
** The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156410</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156410"/>
		<updated>2024-04-24T01:16:21Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
**[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
** In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
** The add_member function's DRY violations with the Team Class were able to be eliminated here, as now the Mentored Team Decorator calls to the assignment team's add member function on line 14, and then simply calls to assign the mentor on line 16.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156409</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156409"/>
		<updated>2024-04-24T01:14:54Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
**[[File:MentoredTeamClass.png | 600px]] ---&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
** In particular this required changing the MentoredTeam to have its own assignment team variable. &lt;br /&gt;
** The add_member function's DRY violations with the Team Class were able to be eliminated here as now the Mentored Team Decorator calls to the assignment team's add member function, and then simply calls to assign the mentor after.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156406</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156406"/>
		<updated>2024-04-24T01:11:14Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
* To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
*[[File:MentoredTeamClass.png | 600px]] --&amp;gt; [[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:MentoredTeamClass.png&amp;diff=156405</id>
		<title>File:MentoredTeamClass.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:MentoredTeamClass.png&amp;diff=156405"/>
		<updated>2024-04-24T01:10:20Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156389</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156389"/>
		<updated>2024-04-24T00:58:45Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
[[File:MentoredTeamDecorator.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:MentoredTeamDecorator.png&amp;diff=156387</id>
		<title>File:MentoredTeamDecorator.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:MentoredTeamDecorator.png&amp;diff=156387"/>
		<updated>2024-04-24T00:56:02Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156375</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156375"/>
		<updated>2024-04-24T00:44:44Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
To remove DRY violations, we transformed the MentoredTeam class into the MentoredTeamDecoratorClass.&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156371</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156371"/>
		<updated>2024-04-24T00:43:46Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
&lt;br /&gt;
== Implementation - To delete later ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156365</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156365"/>
		<updated>2024-04-24T00:40:54Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
* app/controllers/sign_up_sheet_controller.rb&lt;br /&gt;
* app/controllers/teams_controller.rb&lt;br /&gt;
* app/controllers/teams_users_controller.rb&lt;br /&gt;
* app/models/course.rb&lt;br /&gt;
* app/models/mentor_management.rb&lt;br /&gt;
* app/views/sign_up_sheet/_table_header.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_table_line.html.erb&lt;br /&gt;
* app/views/sign_up_sheet/_topic.html.erb&lt;br /&gt;
* app/views/teams/_team.html.erb&lt;br /&gt;
* app/views/tree_display/_page_footer_assignments.html.erb&lt;br /&gt;
* app/views/tree_display/_entry_assignments.html.erb&lt;br /&gt;
* app/models/mentored_team_decorator.rb&lt;br /&gt;
* app/models/team.rb&lt;br /&gt;
* app/views/mailer/team_addition_message.html.erb&lt;br /&gt;
* app/views/mailer/team_addition_message.text.erb&lt;br /&gt;
* app/helpers/mailer_helper.rb&lt;br /&gt;
* app/mailers/mailer.rb&lt;br /&gt;
* spec/models/team_spec.rb&lt;br /&gt;
* spec/models/mentor_management_spec.rb&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156335</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156335"/>
		<updated>2024-04-24T00:29:59Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* mentored_team.rb --&amp;gt; mentored_team_decorator */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* To reduce DRY violations, the mentored team class was changed to the mentored team decorator class. &lt;br /&gt;
*&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
Refer to the demo video on the bottom of the page to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2789&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156331</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156331"/>
		<updated>2024-04-24T00:28:41Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* mentored_team.rb */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb --&amp;gt; mentored_team_decorator ====&lt;br /&gt;
* This file needs to be modified to implement the functionality of delegation instead of inheritance&lt;br /&gt;
* The &amp;quot;add_member&amp;quot; method must function as previously intended during reimplementation&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Link to the [https://www.youtube.com/ video] to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating a team with topic ====&lt;br /&gt;
* Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
* Go to Manage &amp;gt; Courses&lt;br /&gt;
* Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
* Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create a new topic for the assignment and enter a mentor name to the topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* When a student is added to the topic, the team of the student along with the mentor will be displayed in the topic row&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* When navigating to the teams page of that assignment, you can see a mentor assigned automatically&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. &lt;br /&gt;
The test coverage indicated &amp;lt;b&amp;gt;1730&amp;lt;/b&amp;gt; lines of code was covered through the testcases.&lt;br /&gt;
&lt;br /&gt;
[[File:Testing E2403.png ‎| 600px]]&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO::&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/xxxx&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156320</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=156320"/>
		<updated>2024-04-24T00:21:32Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb ====&lt;br /&gt;
* This file needs to be modified to implement the functionality of delegation instead of inheritance&lt;br /&gt;
* The &amp;quot;add_member&amp;quot; method must function as previously intended during reimplementation&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignment&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implemented.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignment&lt;br /&gt;
* The form to create a new topic has a new field to assign mentor to a topic&lt;br /&gt;
[[File:UI2 E2403.png | 600px]]&lt;br /&gt;
* The updated UI showing the topics with the mentors and teams that have chosen the topic&lt;br /&gt;
* The mentor is also displayed with the team&lt;br /&gt;
[[File:UI3 E2403.png | 600px]]&lt;br /&gt;
* The assignment teams page has the modified UI from the Phase 1 as the teams have a mentor&lt;br /&gt;
[[File:UI4 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. Test cases for mentor management were already written and we wrote new test cases for the new functionalities we added. Here are the four test case scenarios we covered and the actual ruby code for the Rspec tests&lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing  Scenarios===&lt;br /&gt;
1. &amp;lt;b&amp;gt;Test scenario 1:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with different team counts for the assignment, Then it should return the mentor with the lowest team count&lt;br /&gt;
  it &amp;quot;returns the mentor with the lowest team count for the given assignment&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 2]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
2. &amp;lt;b&amp;gt;Test scenario 2:&amp;lt;/b&amp;gt; Given an assignment_id, When there is only one mentor available for the assignment, Then it should return that mentor&lt;br /&gt;
  it &amp;quot;should return that mentor if there's only one available&amp;quot; do&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 0]])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
3. &amp;lt;b&amp;gt;Test scenario 3:&amp;lt;/b&amp;gt; Given an assignment_id, When there are multiple mentors with the same lowest team count for the assignment, Then it should return the first mentor in the list&lt;br /&gt;
  it &amp;quot;returns the first mentor in the list if there's a tie for lowest team count&amp;quot; do&lt;br /&gt;
        # Arrange&lt;br /&gt;
        allow(MentorManagement).to receive(:zip_mentors_with_team_count)&lt;br /&gt;
                                     .with(assignment.id)&lt;br /&gt;
                                     .and_return([[mentor.id, 1], [998, 1],])&lt;br /&gt;
        allow(User).to receive(:where).with(id: mentor.id).and_return([mentor])&lt;br /&gt;
        selected_mentor = MentorManagement.select_mentor(assignment.id)&lt;br /&gt;
        expect(selected_mentor).to eq mentor &lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
4. &amp;lt;b&amp;gt;Test scenario 4:&amp;lt;/b&amp;gt; Given an assignment_id, When there are no mentors available for the assignment, Then it should return nil&lt;br /&gt;
  it &amp;quot;returns nil&amp;quot; do&lt;br /&gt;
        # Create a new assignment&lt;br /&gt;
        a = FactoryBot.create(:assignment, id: 997, directory_path: 'OSS_project', auto_assign_mentor: true)&lt;br /&gt;
        # Since there are no mentors associated with this assignment, should return nil&lt;br /&gt;
        expect(MentorManagement.select_mentor(a.id)).to eq nil&lt;br /&gt;
   end&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Link to the [https://www.youtube.com/ video] to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating an mentored team with topic ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. The test coverage indicated &amp;lt;b&amp;gt;x%&amp;lt;/b&amp;gt; percent of code was covered through the testcases. &lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO::&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/xxxx&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155563</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155563"/>
		<updated>2024-04-09T02:43:45Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* mailer_helper */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb ====&lt;br /&gt;
* This file needs to be modified to implement the functionality of delegation instead of inheritance&lt;br /&gt;
* The &amp;quot;add_member&amp;quot; method must function as previously intended during reimplementation&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_team_confimration_to_user will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignemnt&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implmeneted.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignemnt&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. &lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing ===&lt;br /&gt;
Functionalities introduced by our code that needs to be tested:&lt;br /&gt;
# When a mentored team is created and has meetings dates, testing the CRUD functionality of the mentor-meetings.&lt;br /&gt;
# When a mentored team is created with a topic, the mentor should be assigned automatically when the size of the team reaches over 50%.&lt;br /&gt;
# Mentored team should be delegated and so it must be a object of Assignment team&lt;br /&gt;
&lt;br /&gt;
==== Testing model methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
==== Testing controller methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Link to the [https://www.youtube.com/ video] to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating an mentored team with topic ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. The test coverage indicated &amp;lt;b&amp;gt;x%&amp;lt;/b&amp;gt; percent of code was covered through the testcases. &lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO::&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/xxxx&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155562</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155562"/>
		<updated>2024-04-09T02:43:23Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Mailer Changes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb ====&lt;br /&gt;
* This file needs to be modified to implement the functionality of delegation instead of inheritance&lt;br /&gt;
* The &amp;quot;add_member&amp;quot; method must function as previously intended during reimplementation&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_confimration_to_users will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignemnt&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implmeneted.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignemnt&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. &lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing ===&lt;br /&gt;
Functionalities introduced by our code that needs to be tested:&lt;br /&gt;
# When a mentored team is created and has meetings dates, testing the CRUD functionality of the mentor-meetings.&lt;br /&gt;
# When a mentored team is created with a topic, the mentor should be assigned automatically when the size of the team reaches over 50%.&lt;br /&gt;
# Mentored team should be delegated and so it must be a object of Assignment team&lt;br /&gt;
&lt;br /&gt;
==== Testing model methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
==== Testing controller methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Link to the [https://www.youtube.com/ video] to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating an mentored team with topic ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. The test coverage indicated &amp;lt;b&amp;gt;x%&amp;lt;/b&amp;gt; percent of code was covered through the testcases. &lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO::&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/xxxx&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155561</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management_(Phase_2)&amp;diff=155561"/>
		<updated>2024-04-09T02:38:40Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation Plan */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Expertiza ==&lt;br /&gt;
&lt;br /&gt;
[http://expertiza.ncsu.edu/ Expertiza] is a [http://rubyonrails.org/ Ruby on Rails] based open source project. Instructors have the ability to add new projects, assignments, etc., as well as edit existing ones. Later on, they can view student submissions and grade them. Students can also use Expertiza to organize into teams to work on different projects and assignments and submit their work. They can also review other students' submissions.&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This project is the continuation of [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management/ E2304] for the implementation of the Mentor-meeting management in the Expertiza system for mentored teams. We are now required to add functionality to add mentors to the topics and then assign them to the teams when they pick up that topic.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The following tasks are required for the project:&lt;br /&gt;
#&amp;lt;b&amp;gt;Enhancing Code Clarity:&amp;lt;/b&amp;gt; This involves renaming methods from Project 3 with ambiguous names, optimizing loops and adding comments for unclear lines of code&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Mentored teams:&amp;lt;/b&amp;gt; Reimplement the Mentored team delegate to the Assignment team to reduce complexity and to follow best principles of Object Oriented Design&lt;br /&gt;
#&amp;lt;b&amp;gt;Reimplement Sign Up Sheet or Topics:&amp;lt;/b&amp;gt; Reimplement the SignUpSheet controller to automatically add the mentor to when a topic is created and automatically assign the same mentor to a team when they choose the topic&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for mentor meetings models:&amp;lt;/b&amp;gt; More tests have to be written for Mentor Meeting model&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the mentor meetings controller:&amp;lt;/b&amp;gt; More tests should be written for Mentor meeting controller&lt;br /&gt;
#&amp;lt;b&amp;gt;Writing tests for the signup sheet controller:&amp;lt;/b&amp;gt; Additional tests should be written for signup sheet controller to test the new functionality&lt;br /&gt;
&lt;br /&gt;
== Objectives ==&lt;br /&gt;
We have 3 main objectives for this project.&lt;br /&gt;
* Refactoring of the Mentor-meeting model and controller created for the Project 3&lt;br /&gt;
* Reimplementation of Mentored Teams model and controller for the Project 4&lt;br /&gt;
* Reimplementation of SignUp Sheet controller for the Project 4 to automatically assign mentors to the topics&lt;br /&gt;
&lt;br /&gt;
== Design Goal ==&lt;br /&gt;
While fulfilling all the objectives, the following design rules have to be ensured:&lt;br /&gt;
* Validate proper functioning of all existing and anticipated methods, making any required enhancements or adjustments.&lt;br /&gt;
* Establish loose coupling and tight cohesion for the model and controller to enhance code organization and maintainability.&lt;br /&gt;
* Refactor redundant code in the previous implementation's controller and model methods using DRY principle, eliminating functionality duplication already present in the Expertiza system.&lt;br /&gt;
* Confirm the continued effectiveness of existing test cases following the aforementioned modifications and generate additional test cases as per the need.&lt;br /&gt;
&lt;br /&gt;
== Class UML Diagram ==&lt;br /&gt;
[[File:OODD Proj4 E2403 - Entity Diagram 2.png ‎| 610px]]&lt;br /&gt;
&lt;br /&gt;
== Classes and Relationships ==&lt;br /&gt;
=== Existing Structure ===&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has a &amp;lt;b&amp;gt;Node&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;Assignment&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;Team&amp;lt;/b&amp;gt;&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; is inherited from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt;&lt;br /&gt;
* Every &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; has many &amp;lt;b&amp;gt;MentorMeeting&amp;lt;/b&amp;gt;&lt;br /&gt;
=== Proposed Structure Structure ===&lt;br /&gt;
* &amp;lt;b&amp;gt;MentoredTeam&amp;lt;/b&amp;gt; to be delegated from &amp;lt;b&amp;gt;AssignmentTeam&amp;lt;/b&amp;gt; instead of inheriting from it&lt;br /&gt;
&lt;br /&gt;
== Implementation Plan ==&lt;br /&gt;
=== Modify newly created controller, model and view ===&lt;br /&gt;
==== mentor_meeting_controller.rb ====&lt;br /&gt;
* Edit function names to make them more descriptive&lt;br /&gt;
* Add more descriptive comments for the functions&lt;br /&gt;
==== mentor_meetings_helper.rb ====&lt;br /&gt;
* Move the &amp;quot;get_dates_for_team&amp;quot; function to the model&lt;br /&gt;
* Rename the function to make it more descriptive&lt;br /&gt;
==== _entry_assignments.html.erb ====&lt;br /&gt;
* Add more descriptive comments for the JavaScript functions&lt;br /&gt;
* Move the Ruby code from the template to a helper or the controller&lt;br /&gt;
==== mentored_team.rb ====&lt;br /&gt;
* This file needs to be modified to implement the functionality of delegation instead of inheritance&lt;br /&gt;
* The &amp;quot;add_member&amp;quot; method must function as previously intended during reimplementation&lt;br /&gt;
&lt;br /&gt;
=== Modify existing controller model and view ===&lt;br /&gt;
==== teams/_team.html.erb ====&lt;br /&gt;
* As the mentored team will now be delegated from the assignment team, we need to change the if condition on the top as we are changing MentoredTeam to be delegated from the AssignmentTeam&lt;br /&gt;
==== teams_controller.rb ====&lt;br /&gt;
* This file has to be modified to work with the delegated MentoredTeam&lt;br /&gt;
* These lines will not work as MentoredTeam will not be a model&lt;br /&gt;
[[File:Teams con1.png ‎| 600px]]&lt;br /&gt;
==== sign_up_sheet_controller.rb ====&lt;br /&gt;
* This controller has to be modified to automatically assign mentors or manually add mentors to the topics when they are created&lt;br /&gt;
* This will be followed by a change in schema&lt;br /&gt;
[[File:Signup con1.png | 600px]]&lt;br /&gt;
==== _topic.html.erb ====&lt;br /&gt;
* If we manually have to assign mentors to the topic, we have to include a input field to enter the mentor&lt;br /&gt;
[[File:Topic html.png | 600px]]&lt;br /&gt;
==== schema.rb ====&lt;br /&gt;
* As we are adding a new field to the table, we need to modify the schema&lt;br /&gt;
* We need to write 1 migration to add the field to the table to update the schema file&lt;br /&gt;
[[File:Schema E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== Mailer Changes ===&lt;br /&gt;
====team.rb====&lt;br /&gt;
* The team model must be altered to use delegation for cases where a team would previously be a mentored team. &lt;br /&gt;
====add_member====&lt;br /&gt;
* The add member function must be altered such that the call to mail a user is better named, and that it calls directly to the mailer rather than the mailer helper. &lt;br /&gt;
====mailer_helper====&lt;br /&gt;
* The mailer_helper will be altered such that the send_confimration_to_users will be moved and renamed in the Mailer.rb class instead since using generic_message as such is leading to an unclear design. &lt;br /&gt;
====mailer.rb====&lt;br /&gt;
* A new function to specifically handle messaging users when added to teams will be built in the mailer, rather than just overusing the generic_message function.&lt;br /&gt;
&lt;br /&gt;
== UI Changes ==&lt;br /&gt;
=== UI Changes before Phase 2 code changes ===&lt;br /&gt;
* The mentored assignment teams page has the modified UI from the Phase 1 as it is also a mentored assignemnt&lt;br /&gt;
* But the teams do not have a TA as the automated assignment of mentors has not been implmeneted.&lt;br /&gt;
[[File:UI1 E2403.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
=== UI Changes after Phase 2 code changes ===&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
The mentored assignment teams with topic now has the new UI and the automated mentor assignemnt&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Files Modified/Added ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
When the project was pulled from the main repository, there are not enough tests to cover the additional functionalities that we added. We are planning on using the test skeletons by Mustafa Olmez, as a reference to how and what kind of tests should be written. &lt;br /&gt;
&lt;br /&gt;
=== Automated Rspec Testing ===&lt;br /&gt;
Functionalities introduced by our code that needs to be tested:&lt;br /&gt;
# When a mentored team is created and has meetings dates, testing the CRUD functionality of the mentor-meetings.&lt;br /&gt;
# When a mentored team is created with a topic, the mentor should be assigned automatically when the size of the team reaches over 50%.&lt;br /&gt;
# Mentored team should be delegated and so it must be a object of Assignment team&lt;br /&gt;
&lt;br /&gt;
==== Testing model methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
==== Testing controller methods ====&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Manual UI Testing ===&lt;br /&gt;
Apart from the automated Rspec tests, we are providing manual testing cases that can be used to verify the functioning of the website.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
Link to the [https://www.youtube.com/ video] to find help on testing these cases&lt;br /&gt;
&lt;br /&gt;
==== Scenario 1 - Creating an mentored team ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Auto assign mentors when team hits &amp;gt; 50% capacity?&amp;quot; option is checked&lt;br /&gt;
[[File:MT 1-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
[[File:MT 1-2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
==== Scenario 2 - Adding, editing, deleting mentor meeting dates ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Assigments&lt;br /&gt;
# Assuming you have created a mentored assignment and added participants to it, proceed to the teams page&lt;br /&gt;
# Try entering dates into it teams row and the date should persist&lt;br /&gt;
# You can edit and delete the dates from the rows&lt;br /&gt;
# Team with less than 50% capacity will have the mentor meeting dates disabled&lt;br /&gt;
[[File:MT 2.png | 600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Scenario 3 - Creating an mentored team with topic ====&lt;br /&gt;
# Log into Expertiza using the test credential and navigate to the home page&lt;br /&gt;
# Go to Manage &amp;gt; Courses&lt;br /&gt;
# Assuming you have created a course and added participants to it, proceed to create a team&lt;br /&gt;
# Make sure &amp;quot;Has topics?&amp;quot; option is checked and a topic is created using the Topics tab&lt;br /&gt;
[[File:MT 3-1.png | 600px]]&lt;br /&gt;
* Create team for the assignment and you can see that the team with more than 50% capacity gets a mentor assigned automatically&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Test Coverage ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt; &lt;br /&gt;
We used SimpleCov to generate a coverage report for the Rspec test cases implemeted for the model and controllers. The test coverage indicated &amp;lt;b&amp;gt;x%&amp;lt;/b&amp;gt; percent of code was covered through the testcases. &lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
* UserId: instructor6&lt;br /&gt;
* Password: password&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO:: &amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
This is our [https://www.youtube.com/ demo video] which explain how to create courses, assignments, mentored teams and mentored teams with topics. This video also show how to run the tests of our code changes.&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
&amp;lt;i&amp;gt;&amp;lt;u&amp;gt;&amp;lt;b&amp;gt;TODO::&amp;lt;/b&amp;gt;&amp;lt;/u&amp;gt;&amp;lt;/i&amp;gt;&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/xxxx&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153934</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153934"/>
		<updated>2024-03-24T23:06:07Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Relevant Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
==Background==&lt;br /&gt;
Expertiza is an open-source course management web application, that is maintained by students and teaching staff across NC State and other universities. Specifically, Expertiza is used as a platform to help students learn how to work collaboratively on large Object Oriented Programming Assignments. If you would like to learn more about Expertiza, please check the Expertiza wiki[https://wiki.expertiza.ncsu.edu/index.php?title=Main_Page], or the GitHub page [https://github.com/expertiza]. For our project in particular, we were tasked with improving the mentor management system on Expertiza.&lt;br /&gt;
&lt;br /&gt;
== What is a Mentor? ==&lt;br /&gt;
On Expertiza some users are known as mentors. These mentors can both be added to teams manually and automatically assigned if the assignment moderator chooses to select an option where mentors are automatically assigned to teams above 50% capacity. In practice, this means that if you have a max team size of 3, and 2 teammates have been added to team X then team X will automatically be given a mentor.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The problem we have been faced with is multifaceted. First, we found that when teams are automatically built, students are not getting notified of when they are added to a team. Even more alarming is that when mentors are being added to teams, they aren't getting any type of specialized notification letting them know. Mentors should know when they are mentoring a new team, and students should know when they've been added to a team. &lt;br /&gt;
&lt;br /&gt;
The other problem we have fixed as part of this project is improving the view displaying the listing of the teams. The only listing of teams is on the “Create Teams” page for the assignment.  It shows each team member on a separate line, with the mentor in an arbitrary place on the team.&lt;br /&gt;
&lt;br /&gt;
[[File:Old_Mentor_Meeting_Mangement_View.png|900px]]&lt;br /&gt;
&lt;br /&gt;
Expertiza doesn’t know when mentors met with teams, so there would have to be text fields where this information could be entered.  &lt;br /&gt;
&lt;br /&gt;
The page would have to be accessible to all mentors and course intructors, but a mentor could only enter meetings for the teams they mentored (except that the instructor could edit any of the meeting dates for any mentor).&lt;br /&gt;
&lt;br /&gt;
Our project sought to fix these issues.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
- Add new mailer function for team addition confirmation&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add HTML partials for both the mentor-specific and student-specific emails&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add correct mailer function calls where users/mentors are added&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add tests&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mentor Meeting Management ===&lt;br /&gt;
&lt;br /&gt;
- Create a new view that shows the team listing in a more intuitive and easy way.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add input fields for each team where mentors and instructors can enter new, view, edit dates when mentor meetings were conducted.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Instructors can edit all dates for mentor meetings regardless of the team.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Mentors can also edit dates but only for the team they are mentoring.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add more than three dates for the mentor meetings easily by pressing the + icon at the end of the view.&amp;lt;br/&amp;gt;&lt;br /&gt;
- The meeting dates should not be editable for teams having capacity less than 50%.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Show user information in the view.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
==== add_member ====&lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
First, we added to the add_member functions in both the Team and MentoredTeam models. This is because, as has already been stated, when a member is added, that is when we want the notification to be sent.&lt;br /&gt;
&lt;br /&gt;
==== New Code in add_member ====&lt;br /&gt;
[[File:new_add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We added a check for the assignment_id parameter since there are some cases where add_member is called without an assignment. Additionally, we checked whether a user was a mentor or not, as that will be the determining factor as to which email the user will receive. Of course, we didn't want to do a type check, however, we saw no better options unless we went outside the scope of the assignment and added a whole new mentor class (since mentor is not an actual class in the system). We also had to check that the user is not a participant, as there are some odd scenarios where participants are passed as the user parameter in add_member. Our assignment has nothing to do with the participant class, only the user class, so we simply did a type check to make sure we didn't send emails to participants. Again, we wouldn't normally choose to do a type check, but since it involves code completely outside the scope of this project &amp;quot;participants&amp;quot; we chose to simply check that users aren't participants. &lt;br /&gt;
&lt;br /&gt;
==== send_team_confirmation_mail_to_user ====&lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
Once we know what type of user we are working with, we call the MailerHelper.send_team_confirmation_mail_to_user to send the correct email to the student/mentor. This function discerns the user email, subject, name of user, team name, and assignment name before calling upon the generic_message function in the mailer class to send an actual email.&lt;br /&gt;
&lt;br /&gt;
==== Modified generic_message ====&lt;br /&gt;
[[File:mod_generic_message.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We modified the generic_message function to include the team name as that's something that would be included in most messages. This function then uses the partials seen below to build the exact message our students/mentors will receive in their inbox. (note: generic_message is in mailer.rb under the mailer folder)&lt;br /&gt;
&lt;br /&gt;
==== Student HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
[[File:Student_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
==== Mentor HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
[[File:Mentor_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2769&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2772&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153932</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153932"/>
		<updated>2024-03-24T23:04:09Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
==Background==&lt;br /&gt;
Expertiza is an open-source course management web application, that is maintained by students and teaching staff across NC State and other universities. Specifically, Expertiza is used as a platform to help students learn how to work collaboratively on large Object Oriented Programming Assignments. If you would like to learn more about Expertiza, please check the Expertiza wiki[https://wiki.expertiza.ncsu.edu/index.php?title=Main_Page], or the GitHub page [https://github.com/expertiza]. For our project in particular, we were tasked with improving the mentor management system on Expertiza.&lt;br /&gt;
&lt;br /&gt;
== What is a Mentor? ==&lt;br /&gt;
On Expertiza some users are known as mentors. These mentors can both be added to teams manually and automatically assigned if the assignment moderator chooses to select an option where mentors are automatically assigned to teams above 50% capacity. In practice, this means that if you have a max team size of 3, and 2 teammates have been added to team X then team X will automatically be given a mentor.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The problem we have been faced with is multifaceted. First, we found that when teams are automatically built, students are not getting notified of when they are added to a team. Even more alarming is that when mentors are being added to teams, they aren't getting any type of specialized notification letting them know. Mentors should know when they are mentoring a new team, and students should know when they've been added to a team. &lt;br /&gt;
&lt;br /&gt;
The other problem we have fixed as part of this project is improving the view displaying the listing of the teams. The only listing of teams is on the “Create Teams” page for the assignment.  It shows each team member on a separate line, with the mentor in an arbitrary place on the team.&lt;br /&gt;
&lt;br /&gt;
[[File:Old_Mentor_Meeting_Mangement_View.png|900px]]&lt;br /&gt;
&lt;br /&gt;
Expertiza doesn’t know when mentors met with teams, so there would have to be text fields where this information could be entered.  &lt;br /&gt;
&lt;br /&gt;
The page would have to be accessible to all mentors and course intructors, but a mentor could only enter meetings for the teams they mentored (except that the instructor could edit any of the meeting dates for any mentor).&lt;br /&gt;
&lt;br /&gt;
Our project sought to fix these issues.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
- Add new mailer function for team addition confirmation&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add HTML partials for both the mentor-specific and student-specific emails&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add correct mailer function calls where users/mentors are added&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add tests&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mentor Meeting Management ===&lt;br /&gt;
&lt;br /&gt;
- Create a new view that shows the team listing in a more intuitive and easy way.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add input fields for each team where mentors and instructors can enter new, view, edit dates when mentor meetings were conducted.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Instructors can edit all dates for mentor meetings regardless of the team.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Mentors can also edit dates but only for the team they are mentoring.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add more than three dates for the mentor meetings easily by pressing the + icon at the end of the view.&amp;lt;br/&amp;gt;&lt;br /&gt;
- The meeting dates should not be editable for teams having capacity less than 50%.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Show user information in the view.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
==== add_member ====&lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
First, we added to the add_member functions in both the Team and MentoredTeam models. This is because, as has already been stated, when a member is added, that is when we want the notification to be sent.&lt;br /&gt;
&lt;br /&gt;
==== New Code in add_member ====&lt;br /&gt;
[[File:new_add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We added a check for the assignment_id parameter since there are some cases where add_member is called without an assignment. Additionally, we checked whether a user was a mentor or not, as that will be the determining factor as to which email the user will receive. Of course, we didn't want to do a type check, however, we saw no better options unless we went outside the scope of the assignment and added a whole new mentor class (since mentor is not an actual class in the system). We also had to check that the user is not a participant, as there are some odd scenarios where participants are passed as the user parameter in add_member. Our assignment has nothing to do with the participant class, only the user class, so we simply did a type check to make sure we didn't send emails to participants. Again, we wouldn't normally choose to do a type check, but since it involves code completely outside the scope of this project &amp;quot;participants&amp;quot; we chose to simply check that users aren't participants. &lt;br /&gt;
&lt;br /&gt;
==== send_team_confirmation_mail_to_user ====&lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
Once we know what type of user we are working with, we call the MailerHelper.send_team_confirmation_mail_to_user to send the correct email to the student/mentor. This function discerns the user email, subject, name of user, team name, and assignment name before calling upon the generic_message function in the mailer class to send an actual email.&lt;br /&gt;
&lt;br /&gt;
==== Modified generic_message ====&lt;br /&gt;
[[File:mod_generic_message.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We modified the generic_message function to include the team name as that's something that would be included in most messages. This function then uses the partials seen below to build the exact message our students/mentors will receive in their inbox. (note: generic_message is in mailer.rb under the mailer folder)&lt;br /&gt;
&lt;br /&gt;
==== Student HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
[[File:Student_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
==== Mentor HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
[[File:Mentor_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2769&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Mod_generic_message.png&amp;diff=153931</id>
		<title>File:Mod generic message.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Mod_generic_message.png&amp;diff=153931"/>
		<updated>2024-03-24T23:03:19Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153929</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153929"/>
		<updated>2024-03-24T23:02:26Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
==Background==&lt;br /&gt;
Expertiza is an open-source course management web application, that is maintained by students and teaching staff across NC State and other universities. Specifically, Expertiza is used as a platform to help students learn how to work collaboratively on large Object Oriented Programming Assignments. If you would like to learn more about Expertiza, please check the Expertiza wiki[https://wiki.expertiza.ncsu.edu/index.php?title=Main_Page], or the GitHub page [https://github.com/expertiza]. For our project in particular, we were tasked with improving the mentor management system on Expertiza.&lt;br /&gt;
&lt;br /&gt;
== What is a Mentor? ==&lt;br /&gt;
On Expertiza some users are known as mentors. These mentors can both be added to teams manually and automatically assigned if the assignment moderator chooses to select an option where mentors are automatically assigned to teams above 50% capacity. In practice, this means that if you have a max team size of 3, and 2 teammates have been added to team X then team X will automatically be given a mentor.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The problem we have been faced with is multifaceted. First, we found that when teams are automatically built, students are not getting notified of when they are added to a team. Even more alarming is that when mentors are being added to teams, they aren't getting any type of specialized notification letting them know. Mentors should know when they are mentoring a new team, and students should know when they've been added to a team. &lt;br /&gt;
&lt;br /&gt;
The other problem we have fixed as part of this project is improving the view displaying the listing of the teams. The only listing of teams is on the “Create Teams” page for the assignment.  It shows each team member on a separate line, with the mentor in an arbitrary place on the team.&lt;br /&gt;
&lt;br /&gt;
[[File:Old_Mentor_Meeting_Mangement_View.png|900px]]&lt;br /&gt;
&lt;br /&gt;
Expertiza doesn’t know when mentors met with teams, so there would have to be text fields where this information could be entered.  &lt;br /&gt;
&lt;br /&gt;
The page would have to be accessible to all mentors and course intructors, but a mentor could only enter meetings for the teams they mentored (except that the instructor could edit any of the meeting dates for any mentor).&lt;br /&gt;
&lt;br /&gt;
Our project sought to fix these issues.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
- Add new mailer function for team addition confirmation&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add HTML partials for both the mentor-specific and student-specific emails&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add correct mailer function calls where users/mentors are added&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add tests&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mentor Meeting Management ===&lt;br /&gt;
&lt;br /&gt;
- Create a new view that shows the team listing in a more intuitive and easy way.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add input fields for each team where mentors and instructors can enter new, view, edit dates when mentor meetings were conducted.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Instructors can edit all dates for mentor meetings regardless of the team.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Mentors can also edit dates but only for the team they are mentoring.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add more than three dates for the mentor meetings easily by pressing the + icon at the end of the view.&amp;lt;br/&amp;gt;&lt;br /&gt;
- The meeting dates should not be editable for teams having capacity less than 50%.&amp;lt;br/&amp;gt;&lt;br /&gt;
- Show user information in the view.&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
==== add_member ====&lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
First, we added to the add_member functions in both the Team and MentoredTeam models. This is because, as has already been stated, when a member is added, that is when we want the notification to be sent.&lt;br /&gt;
&lt;br /&gt;
==== New Code in add_member ====&lt;br /&gt;
[[File:new_add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We added a check for the assignment_id parameter since there are some cases where add_member is called without an assignment. Additionally, we checked whether a user was a mentor or not, as that will be the determining factor as to which email the user will receive. Of course, we didn't want to do a type check, however, we saw no better options unless we went outside the scope of the assignment and added a whole new mentor class (since mentor is not an actual class in the system). We also had to check that the user is not a participant, as there are some odd scenarios where participants are passed as the user parameter in add_member. Our assignment has nothing to do with the participant class, only the user class, so we simply did a type check to make sure we didn't send emails to participants. Again, we wouldn't normally choose to do a type check, but since it involves code completely outside the scope of this project &amp;quot;participants&amp;quot; we chose to simply check that users aren't participants. &lt;br /&gt;
&lt;br /&gt;
==== send_team_confirmation_mail_to_user ====&lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
Once we know what type of user we are working with, we call the MailerHelper.send_team_confirmation_mail_to_user to send the correct email to the student/mentor. This function discerns the user email, subject, name of user, team name, and assignment name before calling upon the generic_message function in the mailer class to send an actual email.&lt;br /&gt;
&lt;br /&gt;
==== Modified generic_message ====&lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We modified the generic_message function to include the team name as that's something that would be included in most messages. This function then uses the partials seen below to build the exact message our students/mentors will receive in their inbox. (note: generic_message is in mailer.rb under the mailer folder)&lt;br /&gt;
&lt;br /&gt;
==== Student HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
Student emails are built with the following HTML partial:&lt;br /&gt;
&lt;br /&gt;
[[File:Student_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
==== Mentor HTML Partial ====&lt;br /&gt;
Mentors should also be emailed when added to a team, however, their email should look a bit different: &lt;br /&gt;
&lt;br /&gt;
[[File:Mentor_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2769&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153917</id>
		<title>CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2403_Mentor-Meeting_Management&amp;diff=153917"/>
		<updated>2024-03-24T22:56:39Z</updated>

		<summary type="html">&lt;p&gt;Slkwiatk: /* send_team_confirmation_mail_to_user */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__TOC__&lt;br /&gt;
==Background==&lt;br /&gt;
Expertiza is an open-source course management web application, that is maintained by students and teaching staff across NC State and other universities. Specifically, Expertiza is used as a platform to help students learn how to work collaboratively on large Object Oriented Programming Assignments. If you would like to learn more about Expertiza, please check the Expertiza wiki[https://wiki.expertiza.ncsu.edu/index.php?title=Main_Page], or the GitHub page [https://github.com/expertiza]. For our project in particular, we were tasked with improving the mentor management system on Expertiza.&lt;br /&gt;
&lt;br /&gt;
== What is a Mentor? ==&lt;br /&gt;
On Expertiza some users are known as mentors. These mentors can both be added to teams manually and automatically assigned if the assignment moderator chooses to select an option where mentors are automatically assigned to teams above 50% capacity. In practice, this means that if you have a max team size of 3, and 2 teammates have been added to team X then team X will automatically be given a mentor.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement ==&lt;br /&gt;
The problem we have been faced with is multifaceted. First, we found that when teams are automatically built, students are not getting notified of when they are added to a team. Even more alarming is that when mentors are being added to teams, they aren't getting any type of specialized notification letting them know. Mentors should know when they are mentoring a new team, and students should know when they've been added to a team. &lt;br /&gt;
&lt;br /&gt;
The other problem we have fixed as part of this project is improving the view displaying the listing of the teams. The only listing of teams is on the “Create Teams” page for the assignment.  It shows each team member on a separate line, with the mentor in an arbitrary place on the team.&lt;br /&gt;
&lt;br /&gt;
[[File:Old_Mentor_Meeting_Mangement_View.png|900px]]&lt;br /&gt;
&lt;br /&gt;
Expertiza doesn’t know when mentors met with teams, so there would have to be text fields where this information could be entered.  &lt;br /&gt;
&lt;br /&gt;
The page would have to be accessible to all mentors and course intructors, but a mentor could only enter meetings for the teams they mentored (except that the instructor could edit any of the meeting dates for any mentor).&lt;br /&gt;
&lt;br /&gt;
Our project sought to fix these issues.&lt;br /&gt;
&lt;br /&gt;
== Tasks ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
- Add new mailer function for team addition confirmation&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add HTML partials for both the mentor-specific and student-specific emails&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add correct mailer function calls where users/mentors are added&amp;lt;br/&amp;gt;&lt;br /&gt;
- Add tests&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Mentor Meeting Management ===&lt;br /&gt;
&lt;br /&gt;
-&amp;lt;br/&amp;gt;&lt;br /&gt;
-&amp;lt;br/&amp;gt;&lt;br /&gt;
-&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
=== Email Notifications ===&lt;br /&gt;
&lt;br /&gt;
First, we added to the add_member functions in both the Team and MentoredTeam models. This is because, as has already been stated, when a member is added, that is when we want the notification to be sent. &lt;br /&gt;
&lt;br /&gt;
==== add_member ====&lt;br /&gt;
[[File:add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
We added a check for the assignment_id parameter since there are some cases where add_member is called without an assignment. Additionally, we checked whether a user was a mentor or not, as that will be the determining factor as to which email the user will receive. Of course, we didn't want to do a type check, however, we saw no better options unless we went outside the scope of the assignment and added a whole new mentor class (since mentor is not an actual class in the system). We also had to check that the user is not a participant, as there are some odd scenarios where participants are passed as the user parameter in add_member. Our assignment has nothing to do with the participant class, only the user class, so we simply did a type check to make sure we didn't send emails to participants. Again, we wouldn't normally choose to do a type check, but since it involves code completely outside the scope of this project &amp;quot;participants&amp;quot; we chose to simply check that users aren't participants. &lt;br /&gt;
&lt;br /&gt;
==== New Code in add_member ====&lt;br /&gt;
[[File:new_add_member_email.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
Once we know what type of user we are working with, we call the MailerHelper.send_team_confirmation_mail_to_user to send the correct email to the student/mentor. This function discerns the user email, subject, name of user, team name, and assignment name before calling upon the generic_message function in the mailer class to send an actual email.&lt;br /&gt;
&lt;br /&gt;
==== send_team_confirmation_mail_to_user ====&lt;br /&gt;
[[File:team_confirm.png | 900px]]&lt;br /&gt;
&lt;br /&gt;
==== Student HTML Partial ====&lt;br /&gt;
&lt;br /&gt;
Student emails are built with the following HTML partial:&lt;br /&gt;
&lt;br /&gt;
[[File:Student_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
==== Mentor HTML Partial ====&lt;br /&gt;
Mentors should also be emailed when added to a team, however, their email should look a bit different: &lt;br /&gt;
&lt;br /&gt;
[[File:Mentor_Email.png | 888px]]&lt;br /&gt;
&lt;br /&gt;
== Relevant Links ==&lt;br /&gt;
* '''Github Repository:''' https://github.com/ExtremeMachine12/expertiza&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/2769&lt;br /&gt;
* '''Pull Request:''' https://github.com/expertiza/expertiza/pull/&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
=== Mentor ===&lt;br /&gt;
* Ed Gehringer (efg)&lt;br /&gt;
&lt;br /&gt;
=== Team Members ===&lt;br /&gt;
* Samuel Kwiatkowski-Martin (slkwiatk)&lt;br /&gt;
* Tanmay Pardeshi (tpardes)&lt;br /&gt;
* Bala Logesh Sudalaimuthu Pandian (bsudala)&lt;/div&gt;</summary>
		<author><name>Slkwiatk</name></author>
	</entry>
</feed>