<?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=Skandha</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=Skandha"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Skandha"/>
	<updated>2026-06-29T11:02:04Z</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&amp;diff=156459</id>
		<title>CSC/ECE 517 Spring 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=156459"/>
		<updated>2024-04-24T01:45:59Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2024 - E2401 Implementing and testing import &amp;amp; export controllers]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2405 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2407 Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2428 Replicate Roles and Institution UIs ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2429 Reimplement student_task list]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2430 Reimplement student_task view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding ]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding (Phase 2) ]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2414 Grading Audit Trail]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - NTNX-1 : Extend NDB Operator to Support Postgres HA]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - ‬NTNX-2‬‭ : Snapshot Functionality for provisioned databases]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2411 : Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2416.  Reimplement the Question hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2420. Reimplement student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2424. Reimplement the Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2426. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb (Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2425. Create a Courses user interface in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2431. Reimplement  grades/view_team]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2404 Refactor student teams functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2406 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2421. Reimplement impersonating users (within impersonate controller.rb) - Final Project]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2413. Testing - Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2412. Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2427. UI for questionnaire.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2419. Reimplement duties controller.rb and badges controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2432. UI for Participants.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2402 Implement REST client, REST API, and Graphql API endpoint for repositories]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2400 DevOp for GitHub Miner app]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2439 Testing for view_translation_substitutor.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2442 Reimplement student task controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2443 Reimplement grades_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2434 Reimplement Frontend for the Grades view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2435 Implement Frontend for the My Profile]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2446 Implement Front End for Student Task List]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2444 Implement Frontend for the Review]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2440 Testing for questionnaire_helper, review_bids_helper]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2433 Implement UI for the Student Teams]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2415. Reimplement responses controller.rb (Design Document)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2445. Implement BackEnd for participants.rb (Design Document)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2445. Implement BackEnd for participants.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2441 Reimplement grades/view_team (Phase 2)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2418. Reimplement of due date.rb (Phase 2)]]&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding_(Phase_2)&amp;diff=156454</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding (Phase 2)</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding_(Phase_2)&amp;diff=156454"/>
		<updated>2024-04-24T01:43:41Z</updated>

		<summary type="html">&lt;p&gt;Skandha: Created page with &amp;quot;== Introduction == The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management.   Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic face...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:Lottery_controller.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The lottery_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
*'''Test for the method calculate_bidding_summary_based_on_priority in lottery_controller:'''&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The given test case, #calculate_bidding_summary_based_on_priority, is designed to verify the correct calculation and return of bidding summary data for topics within an assignment. It tests the scenario where a team has placed a bid with the highest priority on a topic. The setup involves creating mock instances of an assignment, a topic under that assignment, a team assigned to the topic, and a bid indicating the team's priority. The test confirms that the method accurately computes the total number of bids and the percentage of first-choice bids, and it ensures that the team's name is correctly associated with the bid in the summary. This case is crucial for the test plan as it ensures that the bidding summary accurately reflects student preferences and priorities in the bidding process, which is integral to the fair assignment of topics.&lt;br /&gt;
&lt;br /&gt;
*'''Test for background color helper method:'''&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for the `LotteryHelper` module’s `#background_color_by_percentage` method ensures that the UI consistently displays the correct color codes for varying percentage ranges. It confirms that percentages within defined thresholds are mapped to specific background colors: light red for low, light orange for medium, and light green for high values. Additionally, it tests the method's response to percentages outside the 0-100% range, expecting no background color to be applied, thereby validating the method’s reliability in handling edge cases. This is a critical part of our test plan to ensure visual consistency and user-friendly feedback within the application.&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156440</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156440"/>
		<updated>2024-04-24T01:35:39Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* New functions that are implemented */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:Lottery_controller.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The lottery_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
*'''Test for the method calculate_bidding_summary_based_on_priority in lottery_controller:'''&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The given test case, #calculate_bidding_summary_based_on_priority, is designed to verify the correct calculation and return of bidding summary data for topics within an assignment. It tests the scenario where a team has placed a bid with the highest priority on a topic. The setup involves creating mock instances of an assignment, a topic under that assignment, a team assigned to the topic, and a bid indicating the team's priority. The test confirms that the method accurately computes the total number of bids and the percentage of first-choice bids, and it ensures that the team's name is correctly associated with the bid in the summary. This case is crucial for the test plan as it ensures that the bidding summary accurately reflects student preferences and priorities in the bidding process, which is integral to the fair assignment of topics.&lt;br /&gt;
&lt;br /&gt;
*'''Test for background color helper method:'''&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for the `LotteryHelper` module’s `#background_color_by_percentage` method ensures that the UI consistently displays the correct color codes for varying percentage ranges. It confirms that percentages within defined thresholds are mapped to specific background colors: light red for low, light orange for medium, and light green for high values. Additionally, it tests the method's response to percentages outside the 0-100% range, expecting no background color to be applied, thereby validating the method’s reliability in handling edge cases. This is a critical part of our test plan to ensure visual consistency and user-friendly feedback within the application.&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Lottery_controller.jpeg&amp;diff=156434</id>
		<title>File:Lottery controller.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Lottery_controller.jpeg&amp;diff=156434"/>
		<updated>2024-04-24T01:34:38Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156419</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156419"/>
		<updated>2024-04-24T01:26:25Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* RSpec Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The lottery_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
*'''Test for the method calculate_bidding_summary_based_on_priority in lottery_controller:'''&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The given test case, #calculate_bidding_summary_based_on_priority, is designed to verify the correct calculation and return of bidding summary data for topics within an assignment. It tests the scenario where a team has placed a bid with the highest priority on a topic. The setup involves creating mock instances of an assignment, a topic under that assignment, a team assigned to the topic, and a bid indicating the team's priority. The test confirms that the method accurately computes the total number of bids and the percentage of first-choice bids, and it ensures that the team's name is correctly associated with the bid in the summary. This case is crucial for the test plan as it ensures that the bidding summary accurately reflects student preferences and priorities in the bidding process, which is integral to the fair assignment of topics.&lt;br /&gt;
&lt;br /&gt;
*'''Test for background color helper method:'''&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The test suite for the `LotteryHelper` module’s `#background_color_by_percentage` method ensures that the UI consistently displays the correct color codes for varying percentage ranges. It confirms that percentages within defined thresholds are mapped to specific background colors: light red for low, light orange for medium, and light green for high values. Additionally, it tests the method's response to percentages outside the 0-100% range, expecting no background color to be applied, thereby validating the method’s reliability in handling edge cases. This is a critical part of our test plan to ensure visual consistency and user-friendly feedback within the application.&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156411</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156411"/>
		<updated>2024-04-24T01:16:46Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* RSpec Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The lottery_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
*'''Test for the method calculate_bidding_summary_based_on_priority in lottery_controller:'''&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The given test case, #calculate_bidding_summary_based_on_priority, is designed to verify the correct calculation and return of bidding summary data for topics within an assignment. It tests the scenario where a team has placed a bid with the highest priority on a topic. The setup involves creating mock instances of an assignment, a topic under that assignment, a team assigned to the topic, and a bid indicating the team's priority. The test confirms that the method accurately computes the total number of bids and the percentage of first-choice bids, and it ensures that the team's name is correctly associated with the bid in the summary. This case is crucial for the test plan as it ensures that the bidding summary accurately reflects student preferences and priorities in the bidding process, which is integral to the fair assignment of topics.&lt;br /&gt;
&lt;br /&gt;
*'''Test for background color helper method:'''&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156398</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156398"/>
		<updated>2024-04-24T01:07:51Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Accomplishment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156397</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156397"/>
		<updated>2024-04-24T01:07:40Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Accomplishment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
Our recent project milestones have successfully optimized the topic bidding system in Expertiza. These enhancements focus on improving the instructor's user experience and providing comprehensive insights into student preferences during the topic selection process. The new features not only simplify the instructors' interaction with the system but also bring to light the trending topics that resonate most with students.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
In this updated interface, instructors now have the ability to enable topic bidding with a simple checkbox selection, adding efficiency to the setup process. The interface also introduces a new button, &amp;quot;Show bids by priority,&amp;quot; which serves as a gateway to a more detailed bid analysis. This new feature simplifies the instructor's oversight of the bidding process, consolidating all the necessary information in one place and enabling quick adjustments to topics based on student interest.&lt;br /&gt;
&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
Here, instructors can view the entire landscape of student bids in an organized and informative manner. The page lists topics alongside detailed bid data, such as the number of first, second, and third priority bids, total bids, and the teams that have placed those bids. It also features a calculated percentage of first-choice bids for each topic, providing immediate insight into student preferences. A tooltip offers a quick reference for understanding the calculation behind these percentages, ensuring transparency. This visualization tool allows instructors to discern which topics are trending and which may require additional promotion or reevaluation, streamlining the decision-making process without the need to switch between different views.&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156391</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156391"/>
		<updated>2024-04-24T01:00:43Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Accomplishment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156368</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156368"/>
		<updated>2024-04-24T00:41:33Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Flow of the Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
* The instructor logs in to Expertiza with instructor credentials.&lt;br /&gt;
* They navigate to the Assignments page.&lt;br /&gt;
* An assignment is selected from the list and opened for editing.&lt;br /&gt;
* The instructor checks the &amp;quot;Has Topics&amp;quot; checkbox to activate the Topics tab.&lt;br /&gt;
* The Topics tab is then accessed to add a new topic.&lt;br /&gt;
* A new topic is created by filling out the new topic form and submitting it.&lt;br /&gt;
* This action updates the topic list, and students can begin bidding, assigning their 1st, 2nd, and 3rd priorities to topics.&lt;br /&gt;
* To view the bidding details, the instructor clicks the &amp;quot;Show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view1.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156357</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156357"/>
		<updated>2024-04-24T00:38:48Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Current Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Tooltip.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view1.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Tooltip.png&amp;diff=156351</id>
		<title>File:Tooltip.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Tooltip.png&amp;diff=156351"/>
		<updated>2024-04-24T00:36:59Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156342</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156342"/>
		<updated>2024-04-24T00:32:40Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
The enhanced workflow in Expertiza enables instructors to manage and review student topic bids efficiently. With the new implementation, instructors visit the Assignments page, select an assignment, and activate the Topics tab to manage topics and enable bidding. A newly added &amp;quot;Show bids by priority&amp;quot; button takes users to a comprehensive bidding summary view. This view categorizes and displays detailed bid information, such as the number and percentage of first-choice bids, offering a clear visualization of students' preferences and facilitating fairer topic assignments.&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Instructors can activate topic bidding with a single checkbox.&lt;br /&gt;
* The &amp;quot;Show bids by priority&amp;quot; button leads to a detailed summary view.&lt;br /&gt;
* Bids are categorized by priority, displaying #1, #2, and #3 bids.&lt;br /&gt;
* The percentage of first-choice bids is clearly presented.&lt;br /&gt;
* Bidding teams are listed for complete transparency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages.&lt;br /&gt;
[[File:Bidding_sum_view1.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page.&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. We can also see the tooltip for the calculation of the percentages when we hover over the percentages. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view1.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
#Test for the method calculate_bidding_summary_based_on_priority in lottery_controller.&lt;br /&gt;
The test verifies that the calculate_bidding_summary_based_on_priority method accurately computes and returns a structured summary of bids for topics within an assignment, detailing the number of first, second, and third priority bids, total bids, the percentage of first priority bids, and the teams bidding on each topic.&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#Test for background color helper method&lt;br /&gt;
The test suite for LotteryHelper#background_color_by_percentage method checks that it returns appropriate CSS background colors for low, medium, and high percentage values, and defaults to no background when the percentage is out of the 0-100% range.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156315</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156315"/>
		<updated>2024-04-24T00:20:05Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Project Goal */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation by adding tooltip to show percentage calculation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156312</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156312"/>
		<updated>2024-04-24T00:19:31Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Proposed Solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Project Goal ==&lt;br /&gt;
&lt;br /&gt;
The goal of this project is to enhance the Expertiza bidding system, making it more intuitive and efficient for both instructors and students. Our primary focus areas include:&lt;br /&gt;
&lt;br /&gt;
*'''Clarity and Visibility:''' We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.&lt;br /&gt;
&lt;br /&gt;
*'''Separation of Concerns:''' Based on prior feedback, the bidding logic will be separated from the assignment controller to improve system maintainability and adhere to the Single Responsibility Principle.&lt;br /&gt;
&lt;br /&gt;
*'''Enhanced Logic and Navigation:''' The project will introduce refined logic for calculating preferred choice percentages to ensure fairness in topic assignments. Additionally, bidding results will be moved to a dedicated page, improving the user experience by providing a focused and intuitive navigation.&lt;br /&gt;
&lt;br /&gt;
The UI/UX will be redesigned to minimize clutter, ensuring that information is visible only when necessary and enhancing the overall usability of the interface.&lt;br /&gt;
&lt;br /&gt;
By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156279</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156279"/>
		<updated>2024-04-24T00:00:45Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Issues With Previous Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments. This has also been moved to a separate page, to improve user-experience.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156263</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156263"/>
		<updated>2024-04-23T23:57:00Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Previous Implementations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments. This has also been moved to a separate page, to improve user-experience.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156209</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156209"/>
		<updated>2024-04-23T23:13:28Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Test Login Credentials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments. This has also been moved to a separate page, to improve user-experience.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156207</id>
		<title>CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410_Reimplement_View_for_results_of_bidding&amp;diff=156207"/>
		<updated>2024-04-23T23:12:51Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* E2410 Current Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
===Current Problem===&lt;br /&gt;
*Instructors using Expertiza lack comprehensive visibility into the bidding process, impeding their ability to discern the most sought-after topics by teams and the prioritization of choices, leading to inefficient allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Key Deficiencies===&lt;br /&gt;
*The absence of essential details, such as which teams have bid on specific topics and the percentage of teams assigning their top-choice projects, results in instructors resorting to cumbersome workarounds, hindering effective management and allocation of projects.&lt;br /&gt;
&lt;br /&gt;
===Proposed Solution===&lt;br /&gt;
*Enhancing Expertiza's interface with a dedicated view for instructors to access detailed statistics on topic bids, including priority rankings, team names, total bids, and the percentage of teams selecting each topic as their top choice. This solution aims to streamline workflow, empower instructors with valuable insights, and facilitate fair and efficient project allocation.&lt;br /&gt;
&lt;br /&gt;
== Previous Implementations ==&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/saisanthoshG/expertiza Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2795 E2410 Pull Request]&lt;br /&gt;
#[https://youtu.be/g9DzKE5otSU Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments. This has also been moved to a separate page, to improve user-experience.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
* Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
* Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
 &lt;br /&gt;
* Now go to Topics section and click &amp;quot;Show bids by priority&amp;quot; button.&lt;br /&gt;
[[File:Topics_bid_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
* Here you will be able to view various stats of the bidding,like the topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flow of the Bidding Process ===&lt;br /&gt;
The instructor will login as an instructor, and access the assignments page. Next they will select the assignment from the assignment list and open it for editing. Check the &amp;quot;has topics&amp;quot; checkbox to activate the topics tab and visit it. Now instructor can add a new topic by filling the new topic form. Submit the form and update the topic list. Now the students can start bidding on the topics (assigning their 1st, 2nd and 3rd priorities.  Now the instructor can check the bidding details by clicking &amp;quot;show bids by priority&amp;quot; button on the topics page. &lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
====1. Display bidding summary based on priority details ====&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/92a7f87eaa07853678c0c922ce147a5e71c20661 Method for bidding analysis] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.&lt;br /&gt;
* Prepares data for displaying the bidding details for each topic within an assignment.&lt;br /&gt;
* It calculates the number of bids for each priority (1, 2, 3) per topic and also computes&lt;br /&gt;
* The overall percentages of teams that received their first, second, and third choice.&lt;br /&gt;
* This method is responsible for calculating the bidding table data for an assignment.&lt;br /&gt;
* Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.&lt;br /&gt;
* It checks each team associated with a topic and determines if the team's bid matches&lt;br /&gt;
&lt;br /&gt;
[[File:1_lottery_code.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===2. Background Color according to percentage===&lt;br /&gt;
====[https://github.com/expertiza/expertiza/commit/f111f8cc4edd9ebb904237fad185ab86eb4a4a86 Method for background color] ====&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/helpers/lottery_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
* Light red for low percentages&lt;br /&gt;
* Light orange for medium percentages&lt;br /&gt;
* Light green for high percentages&lt;br /&gt;
* No background if outside range&lt;br /&gt;
[[File:2_color.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===3. Button to show bids by priority===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/11f7b788f6f8bca8dbbfb9477873db07823fc8e9 Button view] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Button to visit the seperate page to view the results of bidding&lt;br /&gt;
[[File:3_button.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
===4. Bidding Summary Table ===&lt;br /&gt;
==== [https://github.com/expertiza/expertiza/commit/b798b78c8c6b649caa139044635b05ecd446a62e Summary Table] ====&lt;br /&gt;
File : &amp;lt;code&amp;gt; app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* View topics with their IDs,&lt;br /&gt;
* View topic names &lt;br /&gt;
* View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid, &lt;br /&gt;
* View the names of those teams&lt;br /&gt;
* View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.&lt;br /&gt;
* View the percentage of first bids with tooltip and custom background&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which allows the instructor to see all topics with their IDs, their respective topic names, number of teams that have put that specific topic as their 1st 2nd and 3rd priority bid, along with the names of those teams, the total number of bids and finally the percentage of teams that put the specific topic as their first bid. This information will allow us to see which topic is most trending, ie, what is the topic most students want to work on, and which topics are not doing so well. This enables the instructor to get this information without having to login to the student view and figure this out manually. &lt;br /&gt;
[[File:Bidding_sum_view.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
* lottery_controller_spec.rb&lt;br /&gt;
*tests for calculate_bidding_summary_based_on_priority in lottery_controller&lt;br /&gt;
 &amp;lt;pre&amp;gt;describe '#calculate_bidding_summary_based_on_priority' do&lt;br /&gt;
    it 'calculates and returns bidding summary data for topics' do&lt;br /&gt;
      # Setup test data&lt;br /&gt;
      assignment = create(:assignment)&lt;br /&gt;
      topic = create(:topic, assignment: assignment)&lt;br /&gt;
      team = create(:team, assignment: assignment)&lt;br /&gt;
      bid = create(:bid, topic: topic, team: team, priority: 1)&lt;br /&gt;
      team_name = create(:team_name, team: team)&lt;br /&gt;
&lt;br /&gt;
      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([topic])&lt;br /&gt;
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])&lt;br /&gt;
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)&lt;br /&gt;
&lt;br /&gt;
      # Mock params&lt;br /&gt;
      params = { id: assignment.id }&lt;br /&gt;
      allow(controller).to receive(:params).and_return(params)&lt;br /&gt;
&lt;br /&gt;
      # Expected data structure from calculate_bidding_summary_based_on_priority&lt;br /&gt;
      expected_topic_data = [&lt;br /&gt;
        {&lt;br /&gt;
          id: topic.id,&lt;br /&gt;
          name: topic.topic_name,&lt;br /&gt;
          first_bids: 1,&lt;br /&gt;
          second_bids: 0,&lt;br /&gt;
          third_bids: 0,&lt;br /&gt;
          total_bids: 1,&lt;br /&gt;
          percentage_first: 100.0,&lt;br /&gt;
          bidding_teams: [team_name]&lt;br /&gt;
        }&lt;br /&gt;
      ]&lt;br /&gt;
&lt;br /&gt;
      # Call the method&lt;br /&gt;
      controller.instance_variable_set(:@assignment, assignment)&lt;br /&gt;
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*tests for background color helper method&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # Assuming your helper module is in the helpers folder&lt;br /&gt;
  RSpec.describe LotteryHelper, type: :helper do&lt;br /&gt;
  # Test for low percentage range&lt;br /&gt;
  describe '#background_color_by_percentage' do&lt;br /&gt;
    it 'returns light red for low percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for medium percentage range&lt;br /&gt;
    it 'returns light orange for medium percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for high percentage range&lt;br /&gt;
    it 'returns light green for high percentages' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    # Test for percentage out of range&lt;br /&gt;
    it 'returns no background for percentages out of range' do&lt;br /&gt;
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')&lt;br /&gt;
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/g9DzKE5otSU Demonstration Video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
===Mentor:===&lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===Members: ===&lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
===References===&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=154417</id>
		<title>CSC/ECE 517 Spring 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024&amp;diff=154417"/>
		<updated>2024-03-25T02:00:25Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;* [[CSC/ECE 517 Spring 2024 - E2405 Refactor review_mapping_helper.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2407 Refactor review_mapping_controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2428 Replicate Roles and Institution UIs ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2429 Reimplement student_task list]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2430 Reimplement student_task view]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding ]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2414 Grading Audit Trail]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - NTNX-1 : Extend NDB Operator to Support Postgres HA]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - ‬NTNX-2‬‭ : Snapshot Functionality for provisioned databases]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2411 : Fix &amp;quot;Back&amp;quot; link on “New Late Policy” page]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2416.  Reimplement the Question hierarchy]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2420. Reimplement student_quizzes_controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2424. Reimplement the Bookmarks Controller]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2426. Create a UI for Assignment Edit page &amp;quot;Etc&amp;quot; tab in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2417. Reimplement submitted content controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2425. Create a Courses user interface in ReactJS]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2431. Reimplement  grades/view_team]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2404 Refactor student teams functionality]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2403 Mentor-Meeting Management]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2421. Reimplement impersonating users (within impersonate controller.rb)]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2413. Testing - Answer Tagging]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2412. Testing for hamer.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2427. UI for questionnaire.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2419. Reimplement duties controller.rb and badges controller.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - E2432. UI for Participants.rb]]&lt;br /&gt;
* [[CSC/ECE 517 Spring 2024 - G2402 Implement REST client, REST API, and Graphql API endpoint for repositories]]&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154413</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154413"/>
		<updated>2024-03-25T01:56:57Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* RSpec Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flow chartb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154410</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154410"/>
		<updated>2024-03-25T01:53:48Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagramb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flow chartb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagramb.jpeg&amp;diff=154407</id>
		<title>File:Sequence Diagramb.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagramb.jpeg&amp;diff=154407"/>
		<updated>2024-03-25T01:53:32Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154403</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154403"/>
		<updated>2024-03-25T01:53:01Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flow chartb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagram.jpeg&amp;diff=154401</id>
		<title>File:Sequence Diagram.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagram.jpeg&amp;diff=154401"/>
		<updated>2024-03-25T01:52:14Z</updated>

		<summary type="html">&lt;p&gt;Skandha: Skandha uploaded a new version of File:Sequence Diagram.jpeg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154395</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154395"/>
		<updated>2024-03-25T01:50:43Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Flowchart for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flow chartb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagram.jpeg&amp;diff=154394</id>
		<title>File:Sequence Diagram.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Sequence_Diagram.jpeg&amp;diff=154394"/>
		<updated>2024-03-25T01:50:01Z</updated>

		<summary type="html">&lt;p&gt;Skandha: Skandha uploaded a new version of File:Sequence Diagram.jpeg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow_chartb.jpeg&amp;diff=154393</id>
		<title>File:Flow chartb.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flow_chartb.jpeg&amp;diff=154393"/>
		<updated>2024-03-25T01:49:51Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154386</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154386"/>
		<updated>2024-03-25T01:48:30Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Flowchart for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowchartb.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154377</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154377"/>
		<updated>2024-03-25T01:47:20Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowchart.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Flowchart.jpeg&amp;diff=154374</id>
		<title>File:Flowchart.jpeg</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Flowchart.jpeg&amp;diff=154374"/>
		<updated>2024-03-25T01:46:47Z</updated>

		<summary type="html">&lt;p&gt;Skandha: Skandha uploaded a new version of File:Flowchart.jpeg&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154368</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154368"/>
		<updated>2024-03-25T01:46:04Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Design */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Flowchart for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:flowchart.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154356</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154356"/>
		<updated>2024-03-25T01:43:55Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-top: 20px;&amp;quot;&amp;gt;&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154343</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154343"/>
		<updated>2024-03-25T01:41:21Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154338</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154338"/>
		<updated>2024-03-25T01:40:24Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[File:Sequence Diagram.jpeg|frameless|upright=3]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154337</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154337"/>
		<updated>2024-03-25T01:39:58Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Sequence Diagram for Bidding Process */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&lt;br /&gt;
[File:Sequence Diagram.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154336</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154336"/>
		<updated>2024-03-25T01:38:59Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Accomplishment */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154325</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154325"/>
		<updated>2024-03-25T01:35:18Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
* Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.&lt;br /&gt;
* Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.&lt;br /&gt;
* Move to the 'Topics' tab and check the 'Enable bidding for topics' option.&lt;br /&gt;
* Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.&lt;br /&gt;
* Log in as a student and bid on the new topic, choosing the priority level for the bid.&lt;br /&gt;
* Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.&lt;br /&gt;
* Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.&lt;br /&gt;
* Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154321</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154321"/>
		<updated>2024-03-25T01:33:08Z</updated>

		<summary type="html">&lt;p&gt;Skandha: /* Manual Testing */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
Follow these instructions to manually test the below functionality:&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154318</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154318"/>
		<updated>2024-03-25T01:32:19Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
===RSpec Testing===&lt;br /&gt;
&lt;br /&gt;
The assignment_controller_spec.rb has existing automated rspec tests in place. Furthermore following tests were added to the code to ensure the functionality is working as expected and thereby increasing code coverage:-&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment__controller_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#bidding_details' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details template' do&lt;br /&gt;
      allow(Assignment).to receive(:find).with('1').and_return(assignment)&lt;br /&gt;
      allow(assignment).to receive(:sign_up_topics).and_return([double('SignUpTopic', id: 1)])&lt;br /&gt;
      allow(Bid).to receive(:where).with(topic_id: 1).and_return([])&lt;br /&gt;
      allow(assignment).to receive(:calculate_percentage_of_teams_getting_choices).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:teams_bidding_for_each_topic).and_return({})&lt;br /&gt;
      allow(assignment).to receive(:assigned_teams_for_topics).and_return({})&lt;br /&gt;
      &lt;br /&gt;
      get :bidding_details, params: { id: 1 }&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:assignment)).to eq(assignment)&lt;br /&gt;
      expect(assigns(:bids_by_topic)).to eq({ 1 =&amp;gt; [] })&lt;br /&gt;
      expect(response).to render_template('bidding_details')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  describe '#bidding_details_for_topic' do&lt;br /&gt;
    it 'assigns necessary variables and renders bidding_details_for_topic template' do&lt;br /&gt;
      topic = double('SignUpTopic', id: 1)&lt;br /&gt;
      bids = [double('Bid')]&lt;br /&gt;
&lt;br /&gt;
      allow(SignUpTopic).to receive(:includes).with(:bids).and_return(SignUpTopic)&lt;br /&gt;
      allow(SignUpTopic).to receive(:find).with(1).and_return(topic)&lt;br /&gt;
      allow(topic).to receive(:bids).and_return(bids)&lt;br /&gt;
&lt;br /&gt;
      get :bidding_details_for_topic, params: { topic_id: 1 }, format: :js&lt;br /&gt;
      &lt;br /&gt;
      expect(assigns(:topic)).to eq(topic)&lt;br /&gt;
      expect(assigns(:bids)).to eq(bids)&lt;br /&gt;
      expect(response).to render_template('bidding_details_for_topic')&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Similarly, the file assignment_spec.rb have the automated rspec tests in them, Few more test case were added to verify the functionalities added.&lt;br /&gt;
&lt;br /&gt;
-&amp;gt; assignment_spec.rb&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;describe '#calculate_percentage_of_teams_getting_choices' do&lt;br /&gt;
  it 'calculates the percentage of teams getting their choices' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    topic1 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    topic2 = build(:sign_up_topic, assignment_id: assignment.id)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive(:sign_up_topics).and_return([topic1, topic2])&lt;br /&gt;
    allow(Team).to receive(:where).and_return([team1, team2])&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic1).and_return(bid1)&lt;br /&gt;
    allow(team1).to receive(:bid_for_topic).with(topic2).and_return(bid2)&lt;br /&gt;
    allow(team2).to receive(:bid_for_topic).with(topic2).and_return(bid3)&lt;br /&gt;
&lt;br /&gt;
    # Perform the calculation&lt;br /&gt;
    percentages = assignment.calculate_percentage_of_teams_getting_choices&lt;br /&gt;
&lt;br /&gt;
    # Perform your assertions here&lt;br /&gt;
    expect(percentages[1]).to eq(50.0)&lt;br /&gt;
    expect(percentages[2]).to eq(100.0)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#teams_bidding_for_each_topic' do&lt;br /&gt;
  it 'returns teams bidding for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team)&lt;br /&gt;
    team2 = build(:team)&lt;br /&gt;
    bid1 = build(:bid, team: team1, topic: topic1)&lt;br /&gt;
    bid2 = build(:bid, team: team1, topic: topic2)&lt;br /&gt;
    bid3 = build(:bid, team: team2, topic: topic2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :map).and_return([['Team1', 1]])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :map).and_return([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.teams_bidding_for_each_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([['Team1', 1]])&lt;br /&gt;
    expect(result[2]).to eq([['Team1', 1], ['Team2', 2]])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#bidding_info_by_topic' do&lt;br /&gt;
  it 'returns bidding information by topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    bid1 = build(:bid, team: team1, priority: 1)&lt;br /&gt;
    bid2 = build(:bid, team: team2, priority: 2)&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:bids, :includes, :map).and_return([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.bidding_info_by_topic&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq([{ team_name: 'Team1', bid_priority: 1 }])&lt;br /&gt;
    expect(result[2]).to eq([{ team_name: 'Team2', bid_priority: 2 }])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
describe '#assigned_teams_for_topics' do&lt;br /&gt;
  it 'returns assigned teams for each topic' do&lt;br /&gt;
    # Mock necessary objects for the test&lt;br /&gt;
    assignment = build(:assignment)&lt;br /&gt;
    topic1 = build(:sign_up_topic, id: 1)&lt;br /&gt;
    topic2 = build(:sign_up_topic, id: 2)&lt;br /&gt;
    team1 = build(:team, name: 'Team1')&lt;br /&gt;
    team2 = build(:team, name: 'Team2')&lt;br /&gt;
    allow(assignment).to receive_message_chain(:sign_up_topics, :includes).and_return([topic1, topic2])&lt;br /&gt;
    allow(topic1).to receive_message_chain(:assigned_teams, :map).and_return(['Team1'])&lt;br /&gt;
    allow(topic2).to receive_message_chain(:assigned_teams, :map).and_return(['Team2'])&lt;br /&gt;
&lt;br /&gt;
    # Call the method&lt;br /&gt;
    result = assignment.assigned_teams_for_topics&lt;br /&gt;
&lt;br /&gt;
    # Perform assertions&lt;br /&gt;
    expect(result[1]).to eq(['Team1'])&lt;br /&gt;
    expect(result[2]).to eq(['Team2'])&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:M2spec.png&amp;diff=154307</id>
		<title>File:M2spec.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:M2spec.png&amp;diff=154307"/>
		<updated>2024-03-25T01:27:01Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:M1spec.png&amp;diff=154306</id>
		<title>File:M1spec.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:M1spec.png&amp;diff=154306"/>
		<updated>2024-03-25T01:26:55Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Cspec.png&amp;diff=154305</id>
		<title>File:Cspec.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Cspec.png&amp;diff=154305"/>
		<updated>2024-03-25T01:26:48Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154300</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154300"/>
		<updated>2024-03-25T01:23:48Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
&lt;br /&gt;
=== Manual Testing ===&lt;br /&gt;
&lt;br /&gt;
=== Rspec Testing ===&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154292</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154292"/>
		<updated>2024-03-25T01:21:04Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154290</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154290"/>
		<updated>2024-03-25T01:19:44Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
The ⁠ bid_intensity_class ⁠ method in the Assignment Helper serves the following functions:&lt;br /&gt;
&lt;br /&gt;
* Determines the CSS class to be applied based on the total number of bids for a topic.&lt;br /&gt;
* If the total bids are between 0 and 5, it returns the class name 'bid-low-intensity'.&lt;br /&gt;
* For total bids between 6 and 10, it returns 'bid-medium-intensity'.&lt;br /&gt;
* If the number of bids exceeds 10, it yields 'bid-high-intensity'.&lt;br /&gt;
* This method assists in visually differentiating the intensity of bidding on topics through color-coding or other styling cues in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Displays the header &amp;quot;Bidding Details&amp;quot; along with the name of the current assignment.&lt;br /&gt;
* Iterates over each topic that has received bids.&lt;br /&gt;
* Retrieves and displays the name of each topic.&lt;br /&gt;
* Creates a table structure with headers &amp;quot;Team Name&amp;quot; and &amp;quot;Bid Priority&amp;quot;.&lt;br /&gt;
* Loops through the bids associated with each topic.&lt;br /&gt;
* For each bid, it displays the name of the team that placed the bid.&lt;br /&gt;
* Also for each bid, it displays the priority level of the bid (e.g., 1st priority, 2nd priority).&lt;br /&gt;
* Structures the data in a tabular format for clear visualization of teams and their bidding priorities per topic.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154277</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154277"/>
		<updated>2024-03-25T01:16:05Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
*./config/routes.rb&lt;br /&gt;
*./app/models/team.rb&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154268</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154268"/>
		<updated>2024-03-25T01:13:33Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
* bidding_details_for_topic.js.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
[[File:assignmenthelper.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
*./config/routes.rb&lt;br /&gt;
*./app/models/team.rb&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154266</id>
		<title>CSC/ECE 517 Spring 2024 - E2410. View for Results of Bidding</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2024_-_E2410._View_for_Results_of_Bidding&amp;diff=154266"/>
		<updated>2024-03-25T01:12:33Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
The [http://expertiza.ncsu.edu/ Expertiza] project is a dynamic collaboration between students and faculty at NC State University, built on the Ruby on Rails platform. It serves as a hub for fostering cooperative learning and academic collaboration, offering a suite of tools for efficient course and assignment management. &lt;br /&gt;
&lt;br /&gt;
Expertiza empowers instructors with comprehensive control over the learning process, providing insights into various academic facets such as user profiles, courses, assignments, questionnaires, and reviews. With its user-friendly interface and innovative features, Expertiza revolutionizes collaborative learning, facilitating seamless topic creation, group formation, and peer review. Join us in embracing the transformative potential of digital collaboration to redefine the educational experience.&lt;br /&gt;
&lt;br /&gt;
== Test Login Credentials ==&lt;br /&gt;
&amp;lt;li&amp;gt;UserId: instructor6&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Password: password&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Problem Statement: ==&lt;br /&gt;
#Instructors currently lack comprehensive visibility into the bidding process, hindering their ability to understand which topics are most sought after by teams and how teams prioritize their choices.&lt;br /&gt;
#The current system does not provide instructors with essential details such as which teams have bid on specific topics and the percentage of teams assigned their top-choice project.&lt;br /&gt;
#As a result, instructors resort to inefficient workarounds, such as logging in as students to view topic details, which complicates the process and delays access to critical bidding information.&lt;br /&gt;
#This lack of functionality fails to meet instructors' needs for a comprehensive overview of the bidding process, preventing them from effectively managing and allocating projects to teams.&lt;br /&gt;
#Enhancing the topics page and providing instructors with a summary view of the bidding process would empower them with valuable insights, streamline their workflow, and ensure they have the necessary tools to facilitate a fair and efficient project allocation process.&lt;br /&gt;
&lt;br /&gt;
=== Previous Implementations ===&lt;br /&gt;
#[https://github.com/Shreshth-Malik/expertiza E2360 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2659 E2360 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding E2360 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=pGmHyqLj7PM Demo Video]&lt;br /&gt;
&lt;br /&gt;
#[https://github.com/dnguyenv/expertiza/tree/beta E2245 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2392 E2245 Pull Request]&lt;br /&gt;
#[https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2022_-_E2245:_View_for_results_of_bidding E2245 Wiki Page]&lt;br /&gt;
#[https://www.youtube.com/watch?v=OTSRqRihahQ Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== E2410 Current Implementation ===&lt;br /&gt;
#[https://github.com/shiva1239/expertiza E2410 Github Repository]&lt;br /&gt;
#[https://github.com/expertiza/expertiza/pull/2768 E2410 Pull Request]&lt;br /&gt;
#[https://www.youtube.com/watch?v=rfnwqOjLOJ0 Demo Video]&lt;br /&gt;
&lt;br /&gt;
=== Issues With Previous Implementation ===&lt;br /&gt;
# Functions directly fetch and process bids in the controller, which could be better managed through model methods for improved organization.&lt;br /&gt;
# The use of instance variables for bid counts is not scalable and can become problematic with changes in the bidding process.&lt;br /&gt;
# The current approach of fetching topics and iterating for bids may result in inefficient N+1 queries.&lt;br /&gt;
# There's a risk of repeating logic related to bidding across different parts of the application.&lt;br /&gt;
# UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.&lt;br /&gt;
# The views have repetitive non-zero checks for bid counts, which could be streamlined.&lt;br /&gt;
# CSS styles are hard-coded in views, which should be abstracted to CSS files.&lt;br /&gt;
# Missing error handling could cause unhandled exceptions for nonexistent bids or topics.&lt;br /&gt;
# Tests might not cover all scenarios, such as incorrect bid priorities or unrepresented teams.&lt;br /&gt;
# The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.&lt;br /&gt;
&lt;br /&gt;
== Proposed Solution ==&lt;br /&gt;
The design presented in this iteration of the project is very similar to the high-level design proposed last year in [https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2023_-_E2360._View_for_Results_of_Bidding Fall 2023 Design]. Since this pull request was not merged, we have included the proposed changes that are credible. Below is a comparable explanation of the previously offered remedy, as well as some new design decisions to improve upon the previous iteration of this issue.&lt;br /&gt;
&lt;br /&gt;
We've significantly improved the bidding system in Expertiza by enhancing the visibility and handling of bids for topics. Key improvements include detailed bidding data presentation, with distinct columns for each bid priority and clear team bid information. This offers users, both instructors and students, a transparent view into the bidding outcomes. Additionally, our refined logic more accurately calculates teams' preferred choice percentages, aiding better decision-making in topic assignments.&lt;br /&gt;
&lt;br /&gt;
== Design ==&lt;br /&gt;
&lt;br /&gt;
=== Sequence Diagram for Bidding Process ===&lt;br /&gt;
&amp;lt;center&amp;gt;[[File:Sequence Diagram.jpeg|frameless|upright=3]]&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Current Flow === &lt;br /&gt;
&lt;br /&gt;
*Go to the assignments section, we have created a dummy a assignment, &amp;quot;Test OODD&amp;quot;, click edit icon next to it.&lt;br /&gt;
[[File:2410 1.jpeg|frameless|upright=3]] &lt;br /&gt;
&lt;br /&gt;
*Now make sure the &amp;quot;has topics&amp;quot; checkbox is selected.&lt;br /&gt;
[[File:24104.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Now go to Topics section and scroll down to Bid Summary.&lt;br /&gt;
[[File:2410 2.jpeg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
*Here you will be able to view various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
== Implementation Details ==&lt;br /&gt;
=== Files Modified During the implementation ===&lt;br /&gt;
&lt;br /&gt;
* assignments_controller.rb&lt;br /&gt;
* lottery_controller.rb&lt;br /&gt;
* assignment.rb&lt;br /&gt;
* bid.rb&lt;br /&gt;
* team.rb&lt;br /&gt;
* assignment_helper.rb&lt;br /&gt;
* _topics.html.erb&lt;br /&gt;
* bidding_details.html.erb&lt;br /&gt;
* _bid_summary_partial.html.erb&lt;br /&gt;
* bidding_details_for_topic.js.erb&lt;br /&gt;
&lt;br /&gt;
=== New functions that are implemented ===&lt;br /&gt;
'''1. Assignment Controller '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/assignments_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Added `bidding_details` method to `AssignmentController` for aggregating bid data per topic.&lt;br /&gt;
* Implemented data retrieval for each topic's bids within an assignment using `@assignment.sign_up_topics`.&lt;br /&gt;
* Compiled a list of teams assigned to topics, excluding those on the waitlist.&lt;br /&gt;
* Introduced dynamic counting of bids per priority (1, 2, 3) for each topic and stored the results in `@count1`, `@count2`, and `@count3`.&lt;br /&gt;
* Calculated the total number of teams and their respective percentages for obtaining their first, second, and third choice topics.&lt;br /&gt;
* Created `bidding_details_for_topic` method to handle AJAX requests and render bid details for a specific topic.&lt;br /&gt;
* Structured bid data retrieval to support interactive, on-the-fly updates in the user interface.&lt;br /&gt;
&lt;br /&gt;
[[File:App-controller-assignments_controller.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''2. Lottery Controller'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/controllers/lottery_controller.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
(1) Fetching Assignment and Topics:&lt;br /&gt;
* The method retrieves an `Assignment` object based on the provided `id` parameter.&lt;br /&gt;
* It then fetches all `SignUpTopic` objects associated with this assignment, storing them in the `@topics` instance variable.&lt;br /&gt;
&lt;br /&gt;
(2) Gathering Bids Data:&lt;br /&gt;
* It initializes an empty hash `@bids_by_topic` to store bid information by topic.&lt;br /&gt;
* Iterates over each topic and queries the `Bid` model to fetch all bids associated with that topic. Each bid's team and priority information are encapsulated in a hash and stored in the `@bids_by_topic`, keyed by topic ID.&lt;br /&gt;
&lt;br /&gt;
(3) Team Assignments Tracking:&lt;br /&gt;
* Similarly, `@assigned_teams_by_topic` is prepared to hold information on teams assigned to each topic. This is populated by querying `SignedUpTeam` for non-waitlisted teams for each topic.&lt;br /&gt;
&lt;br /&gt;
(4) Dynamic Instance Variables for Priority Counts:&lt;br /&gt;
* The code dynamically initializes and updates three instance variables: `@count1`, `@count2`, and `@count3` for each priority level (1, 2, 3). These variables are hashes that count the number of bids at each priority level for each topic.&lt;br /&gt;
&lt;br /&gt;
(5) Percentage Calculations:&lt;br /&gt;
* After collecting bids and assigned teams, it calculates the total number of teams that made bids and computes the percentage of teams that received their first, second, and third choices. This is facilitated by helper methods `compute_priority_counts` and `compute_percentages`.&lt;br /&gt;
&lt;br /&gt;
(6) Overall Method Functionality:&lt;br /&gt;
* The method effectively prepares a comprehensive data structure detailing the bids for each topic within the assignment. This includes the number of bids at each priority level and the percentages of teams that were able to secure their preferences. This data is essential for presenting a clear picture of the bidding results to the instructors or other stakeholders.&lt;br /&gt;
&lt;br /&gt;
(7) End Result:&lt;br /&gt;
* The computed data is then used to render a view or to further business logic, providing insight into the distribution and success of bids across the different topics, thus aiding in intelligent assignment and team formation based on bidding data.&lt;br /&gt;
[[File:App-controllers-lottery controller.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''3. Assignment Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/assignment.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Calculates the percentage of teams that have been awarded their first, second, and third choice topics based on bidding.&lt;br /&gt;
*  ⁠Utilizes a hash to keep count of the choices, initializing at zero for each choice level.&lt;br /&gt;
*  ⁠Iterates over each team to determine if they've been assigned a topic and subsequently increments the count of the choice they've made.&lt;br /&gt;
*  ⁠Counts the total number of teams to avoid division by zero errors when calculating percentages.&lt;br /&gt;
*  ⁠Transforms the counts into percentages by dividing by the total number of teams and multiplying by 100, rounding to two decimal places.&lt;br /&gt;
*  ⁠Provides the calculated percentages for use in views or other parts of the application.&lt;br /&gt;
&lt;br /&gt;
[[File:assignment model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''4. Bid Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/bid.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* The method for merging bid data from different users was refined with clearer comments.&lt;br /&gt;
* The method now organizes bidding information into a matrix structure, keyed by topic, simplifying the representation of bids for analysis.&lt;br /&gt;
* A new method was introduced to calculate the percentages of teams receiving their preferred choices, with logic to prevent division by zero.&lt;br /&gt;
* The data is then normalized to percentages, providing a concise and accurate calculation for bid analytics.&lt;br /&gt;
&lt;br /&gt;
[[File:App-models-bid.rb.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''5. Team Model '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/models/team.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
* Expanded the Team model with methods to fetch a team’s bid for a given topic.&lt;br /&gt;
* Added functionality to retrieve the assigned sign-up topic for a team.&lt;br /&gt;
* Refined the Team model's interface for interacting with associated bids and sign-up topics.&lt;br /&gt;
&lt;br /&gt;
[[File:bid model.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''6. Assignment Helper '''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/helpers/assignment_helper.rb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
'''7. Topics view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/edit/_topics.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠Introduced conditional checks for displaying specific sections in the topics form based on the assignment's properties like whether it allows suggestions, is intelligent, has a staggered deadline, etc.&lt;br /&gt;
*  ⁠Added a summary section to display aggregated bidding data if bidding is enabled.&lt;br /&gt;
*  ⁠Created a dynamic table that lists out the topic names, the count of first, second, and third priority bids, total bids, and names of bidding teams.&lt;br /&gt;
*⁠  ⁠Implemented a method to classify bid intensity into low, medium, and high based on the total number of bids.&lt;br /&gt;
*  ⁠Added modals to provide detailed bidding information for each topic, which will be populated via an AJAX call to a specified endpoint with the topic ID.&lt;br /&gt;
*  ⁠Set up a JavaScript function to handle click events on information buttons, triggering AJAX calls and displaying bid details in modals.&lt;br /&gt;
&lt;br /&gt;
[[File:topics1.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics2.png|frameless|upright=3]]&lt;br /&gt;
[[File:topics3.png|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
'''8. Bidding Details view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt;./app/views/assignments/bidding_details.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments-bidding details.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9. Bid Summary view'''&lt;br /&gt;
&lt;br /&gt;
File : &amp;lt;code&amp;gt; ./app/views/assignments/_bid_summary_partial.html.erb &amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Functionality:&lt;br /&gt;
&lt;br /&gt;
*  ⁠The snippet is part of a view template that generates a summary of bidding data for assignment topics.&lt;br /&gt;
*  ⁠It checks if there are any sign-up topics associated with the assignment.&lt;br /&gt;
*  ⁠For each topic, it lists out the total number of bids, along with a breakdown of bids by priority level: first, second, and third.&lt;br /&gt;
*  ⁠It also displays the names of teams that have placed bids on the topic.&lt;br /&gt;
*  ⁠The percentage of teams that got their first choice is calculated and displayed, color-coded to indicate the outcome:&lt;br /&gt;
** Red for 0%, indicating no team got their first choice.&lt;br /&gt;
** Green for 100%, indicating all teams got their first choice.&lt;br /&gt;
** Orange for any percentage in between.&lt;br /&gt;
*  ⁠If no bids are present for a topic, it notes that.&lt;br /&gt;
*  ⁠If there are no topics created for the assignment, it informs the user accordingly.&lt;br /&gt;
&lt;br /&gt;
[[File:App-views-assignments- bid summary partial.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
app/views/assignments/edit/_topics.html.erb&lt;br /&gt;
*./config/routes.rb&lt;br /&gt;
*./app/models/team.rb&lt;br /&gt;
&lt;br /&gt;
== Accomplishment ==&lt;br /&gt;
This project has added a &amp;quot;Bid Summary&amp;quot;, which enables the instructor to see various stats of the bidding, like the percentage of teams that got their first choice of project, the number of teams that put the particular project as their first, second and third choice and the individual teams which bid on the particular project.&lt;br /&gt;
[[File:Screenshot 2024-03-24 at 11.42.05 AM.jpg|frameless|upright=3]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Demo Video ==&lt;br /&gt;
You can watch this [https://youtu.be/rfnwqOjLOJ0 demo video]for a detailed demonstration of the project.&lt;br /&gt;
&lt;br /&gt;
== Team ==&lt;br /&gt;
'''Mentor:''' &lt;br /&gt;
*Anvitha Reddy Gutha (agutha@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
'''Members: ''' &lt;br /&gt;
*Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)&lt;br /&gt;
*Sai Santhosh Garlapati (sgarlap@ncsu.edu)&lt;br /&gt;
*Chinmay Walinjkar (cpwalinj@ncsu.edu)&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*https://github.com/expertiza/expertiza&lt;br /&gt;
*http://expertiza.ncsu.edu/&lt;br /&gt;
*http://wiki.expertiza.ncsu.edu/index.php/Expertiza_documentation&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignmenthelper.png&amp;diff=154263</id>
		<title>File:Assignmenthelper.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=File:Assignmenthelper.png&amp;diff=154263"/>
		<updated>2024-03-25T01:09:50Z</updated>

		<summary type="html">&lt;p&gt;Skandha: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Skandha</name></author>
	</entry>
</feed>