CSC/ECE 517 Spring 2024 - E2410 Reimplement View for results of bidding

From Expertiza_Wiki
Jump to navigation Jump to search

Introduction

The 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 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.

Problem Statement:

Current Problem

  • 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.

Key Deficiencies

  • 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.

Proposed Solution

  • 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.

Previous Implementations

  1. E2360 Github Repository
  2. E2360 Pull Request
  3. E2360 Wiki Page
  4. Demo Video

E2410 Current Implementation

  1. Github Repository
  2. E2410 Pull Request
  3. Demo Video

Issues With Previous Implementation

  1. There's a risk of repeating logic related to bidding across different parts of the application.
  2. UI elements and logic are intertwined within the controller, which is not ideal for MVC patterns.
  3. CSS styles are hard-coded in views, which should be abstracted to CSS files.
  4. Missing error handling could cause unhandled exceptions for nonexistent bids or topics.
  5. The UI lacks dynamic feedback mechanisms like AJAX updates for user interactions.


Project Goal

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:

  • Clarity and Visibility: We aim to clearly present bidding results, featuring distinct columns for bid priorities and detailed team bid information.
  • 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.
  • 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.

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.

By achieving these objectives, we intend to significantly improve the bidding system in Expertiza, ensuring it is a more effective tool for educational environments.

Design

Sequence Diagram for Bidding Process

Current Flow

  • Go to the assignments section, we have created a dummy a assignment, "Test OODD", click edit icon next to it.

  • Now make sure the "has topics" checkbox is selected.

  • Now go to Topics section and click "Show bids by priority" button.

  • 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.

Flow of the Bidding Process

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 "has topics" 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 "show bids by priority" button on the topics page.

Implementation Details

Files Modified During the implementation

  • assignments_controller.rb
  • lottery_controller.rb
  • assignment.rb
  • bid.rb
  • team.rb
  • assignment_helper.rb
  • _topics.html.erb
  • bidding_details.html.erb
  • _bid_summary_partial.html.erb

New functions that are implemented

1. Display bidding summary based on priority details

Method for bidding analysis

File : app/controllers/lottery_controller.rb

Functionality:

  • Added `calculate_bidding_summary_based_on_priority` method to `lottery_controller` for aggregating bid data per topic.
  • Prepares data for displaying the bidding details for each topic within an assignment.
  • It calculates the number of bids for each priority (1, 2, 3) per topic and also computes
  • The overall percentages of teams that received their first, second, and third choice.
  • This method is responsible for calculating the bidding table data for an assignment.
  • Computes the count of assigned teams for each priority level (1, 2, 3) across all topics.
  • It checks each team associated with a topic and determines if the team's bid matches

2. Background Color according to percentage

Method for background color

File : app/helpers/lottery_helper.rb

Functionality:

  • Light red for low percentages
  • Light orange for medium percentages
  • Light green for high percentages
  • No background if outside range

3. Button to show bids by priority

Button view

File : app/views/assignments/edit/_topics.html.erb

Functionality:

  • ⁠Button to visit the seperate page to view the results of bidding

4. Bidding Summary Table

Summary Table

File : app/views/lottery/calculate_bidding_summary_based_on_priority.html.erb

Functionality:

  • View topics with their IDs,
  • View topic names
  • View number of teams that have bid on that specific topic as their 1st 2nd and 3rd priority bid,
  • View the names of those teams
  • View the total number of bids and finally the percentage of teams that put the specific topic as their first bid.
  • View the percentage of first bids with tooltip and custom background

Accomplishment

This project has added a "Bid Summary", 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.

Test Plan

Manual Testing

Follow these instructions to manually test the below functionality:

  • Navigate to the assignments page and click on the pencil icon next to the 'Test OODD' assignment.
  • Confirm that the 'Has Topics' checkbox is selected on the general assignment settings page.
  • Move to the 'Topics' tab and check the 'Enable bidding for topics' option.
  • Add a new topic for students to bid on by clicking the 'New Topic' button and entering relevant details.
  • Log in as a student and bid on the new topic, choosing the priority level for the bid.
  • Return to the 'Topics' tab as an instructor to view the updated bidding table with bids and priorities listed.
  • Confirm that the total number of bids and the number of #1, #2, and #3 bids are displayed correctly for each topic.
  • Check the background color coding (green, yellow, red) in the bidding table that reflects the intensity of bids for visual verification.

RSpec Testing

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:-

  • lottery_controller_spec.rb
  • tests for calculate_bidding_summary_based_on_priority in lottery_controller
describe '#calculate_bidding_summary_based_on_priority' do
    it 'calculates and returns bidding summary data for topics' do
      # Setup test data
      assignment = create(:assignment)
      topic = create(:topic, assignment: assignment)
      team = create(:team, assignment: assignment)
      bid = create(:bid, topic: topic, team: team, priority: 1)
      team_name = create(:team_name, team: team)

      allow(Assignment).to receive(:find).with(assignment.id).and_return(assignment)
      allow(assignment).to receive(:sign_up_topics).and_return([topic])
      allow(topic).to receive_message_chain(:bids, :includes).and_return([bid])
      allow(bid).to receive_message_chain(:team, :name).and_return(team_name)

      # Mock params
      params = { id: assignment.id }
      allow(controller).to receive(:params).and_return(params)

      # Expected data structure from calculate_bidding_summary_based_on_priority
      expected_topic_data = [
        {
          id: topic.id,
          name: topic.topic_name,
          first_bids: 1,
          second_bids: 0,
          third_bids: 0,
          total_bids: 1,
          percentage_first: 100.0,
          bidding_teams: [team_name]
        }
      ]

      # Call the method
      controller.instance_variable_set(:@assignment, assignment)
      expect(controller.calculate_bidding_summary_based_on_priority).to eq(expected_topic_data)
    end
  end
  • tests for background color helper method

  # Assuming your helper module is in the helpers folder
  RSpec.describe LotteryHelper, type: :helper do
  # Test for low percentage range
  describe '#background_color_by_percentage' do
    it 'returns light red for low percentages' do
      expect(helper.background_color_by_percentage(10)).to eq('background-color: #ffcccc;')
    end

    # Test for medium percentage range
    it 'returns light orange for medium percentages' do
      expect(helper.background_color_by_percentage(50)).to eq('background-color: #ffcc99;')
    end

    # Test for high percentage range
    it 'returns light green for high percentages' do
      expect(helper.background_color_by_percentage(80)).to eq('background-color: #ccffcc;')
    end

    # Test for percentage out of range
    it 'returns no background for percentages out of range' do
      expect(helper.background_color_by_percentage(101)).to eq('background-color: none;')
      expect(helper.background_color_by_percentage(-1)).to eq('background-color: none;')
    end
  end
end


Demo Video

You can watch this Demonstration Videofor a detailed demonstration of the project.

Team

Mentor:

  • Anvitha Reddy Gutha (agutha@ncsu.edu)

Members:

  • Shiva Vara Prasad Kandhagatla (skandha@ncsu.edu)
  • Sai Santhosh Garlapati (sgarlap@ncsu.edu)
  • Chinmay Walinjkar (cpwalinj@ncsu.edu)

References