CSC/ECE 517 Spring 2022 - E2245: View for results of bidding

From Expertiza_Wiki
Jump to navigation Jump to search

CSC/ECE 517 Spring 2022 - E2245: View for results of bidding

Problem Statement

When students sign up for topics, they are presented with a system to bid on their favorite topics. This process is allowed for both individual students as well as teams. As a result, many students will first sign up for topics, which can reduce the number of teams that get their first pick, and result in long waitlists. There are several bidding algorithms available to the instructors to give as many groups as possible their first choice. As this is an NP-complete problem, the algorithm has to use heuristics to guess efficiently. There needs to be a way for instructors to easily view and compare the results of the bidding algorithms to get a quantitative sense of their effectiveness.

Project Goal

This project aims to solve this issue by giving clear and concise feedback of the algorithms in topics list in the assignment. However, since topics in the table potentially have several fields, care must be taken not to overcrowd the table with information. There are several different UI/UX approaches to display this information, and the chosen one should:

  • Maximize useful information at a glance, while minimizing clutter
  • Fit into the flow of the topic page
  • Allow further information to be obtained if requested
  • Not be visible if bidding is not used

Some other miscellaneous goals of this project are to:

  • Remove topic fields from view if they are not applicable
  • Refactor code
  • Increase test coverage

Previous Work

Current User Cases

Below is the use case diagram that depicts the existing use cases that associated to the topics bidding features of the application. Notice that in order to check some bidding information for a topic/project, the Instructor has to impersonate a student.

Old user cases

Current Work Flow Diagram

As an Instructor, the user after, being authenticated, needs to go to the Assignments >> Topics view to create the topics/projects and then once the bidding started, needs to impersonate a student to partially (at very minimal level) get the bidding process information

Old user cases

Improvement on the Previous Work

Change in Use Cases

Old user cases

Student: This actor is responsible for submitting and deleting bids for topics while the topic selection period is open for an assignment which uses the new lottery topic selection mechanism.

Instructor: This actor is responsible for updating an assignment to use the new lottery topic selection as well as closing the bidding period and beginning the automatic topic selection. Instructor is also able to view the progress details of bids without having to impersonate students

UI design

The existing view with very limited information about the bidding process

Before:

Popup prototype


With this proposed new view, the Instructor can gain a more complete view of the whole bidding process in one place.

Proposed UI

Popup prototype

Change in Work Flow Diagram

With the new flow and implementation, the Instructor now can have all (complete) information he/she needs in one place at the Topics list/details view instead of having to impersonate a student to get even some minimal, un-completed piece of information about the bidding.

Old user cases

Class Diagram

Class diagram

Code changes

From preliminary research, we believed we would need to add and modify, refactor code from almost all layers of the features (including Controllers, Models, Views but we end up decided to focus on delivering the feature with minimum code changes and regression tests, so majority of our code changes are on Views layer. Following are the changes we made (We also added links to our Github commits for each change so that the reviewers can link directly to github for more in-depth inspection/review)


New Files added:

  • app/views/sign_up_sheet/_total_bids.html.erb
  • app/views/sign_up_sheet/_total_1_2_bids.html.erb

Files changed:

View:

  • app/views/sign_up_sheet/_actions.html.erb
  • app/views/sign_up_sheet/_add_signup_topics.html.erb

Add Signup Topics

  • app/views/sign_up_sheet/_table_header.html.erb
  • app/views/sign_up_sheet/_table_line.html.erb

Configuration:

  • config/locales/en_US.yml
  • config/locales/hi_IN.yml

Functionalities added

  • The instructor should be able to see how many teams have bid for each topic without having to impersonate students

Testing

Run and pass all the RSpec Tests (including the existing ones - regression, and the newly added cases)

  describe '#create' do
    context 'when topic cannot be found' do
      context 'when new topic can be saved successfully' do
        it 'sets up a new topic and redirects to assignment#edit page' do
          allow(SignUpTopic).to receive(:where).with(topic_name: 'Hello world!', assignment_id: '1').and_return([nil])
          allow_any_instance_of(SignUpSheetController).to receive(:undo_link)
            .with('The topic: "Hello world!" has been created successfully. ').and_return('OK')
          allow(topic).to receive(:save).and_return('OK')
          request_params = {
            id: 1,
            topic: {
              topic_identifier: 1,
              topic_name: 'Hello world!',
              max_choosers: 1,
              category: '',
              micropayment: 1
            }
          }
          post :create, params: request_params
          expect(response).to redirect_to('/assignments/1/edit#tabs-2')
        end
      end

      context 'when new topic cannot be saved successfully' do
        it 'sets up a new topic and renders sign_up_sheet#new page' do
          allow(SignUpTopic).to receive(:where).with(topic_name: 'Hello world!', assignment_id: '1').and_return([nil])
          allow_any_instance_of(SignUpSheetController).to receive(:undo_link)
            .with('The topic: "Hello world!" has been created successfully. ').and_return('OK')
          allow(topic).to receive(:save).and_return('OK')
          request_params = {
            id: 1,
            topic: {
              topic_identifier: 1,
              topic_name: 'Hello world!',
              category: '',
              micropayment: 1
            }
          }
          post :create, params: request_params
          expect(response).to render_template(:new)
        end
      end
    end

    context 'when topic can be found' do
      it 'updates the existing topic and redirects to sign_up_sheet#add_signup_topics_staggered page' do
        allow(SignedUpTeam).to receive(:find_by).with(topic_id: 1).and_return(signed_up_team)
        allow(SignedUpTeam).to receive(:where).with(topic_id: 1, is_waitlisted: true).and_return([signed_up_team2])
        allow(Team).to receive(:find).with(2).and_return(team)
        allow(SignUpTopic).to receive(:find_waitlisted_topics).with(1, 2).and_return(nil)
        request_params = {
          id: 1,
          topic: {
            topic_identifier: 666,
            topic_name: 'Hello world!',
            max_choosers: 2,
            category: '666',
            micropayment: 1
          }
        }
        post :create, params: request_params
        expect(SignedUpTeam.first.is_waitlisted).to be false
        expect(response).to redirect_to('/sign_up_sheet/add_signup_topics_staggered?id=1')
      end
    end
  end

  describe '#destroy' do
    context 'when topic can be found' do
      it 'redirects to assignment#edit page' do
        allow_any_instance_of(SignUpSheetController).to receive(:undo_link)
          .with('The topic: "Hello world!" has been successfully deleted. ').and_return('OK')
        request_params = { id: 1, assignment_id: 1 }
        post :destroy, params: request_params
        expect(response).to redirect_to('/assignments/1/edit')
      end
    end

    context 'when topic cannot be found' do
      it 'shows an error flash message and redirects to assignment#edit page' do
        allow(SignUpTopic).to receive(:find).with('1').and_return(nil)
        allow_any_instance_of(SignUpSheetController).to receive(:undo_link)
          .with('The topic: "Hello world!" has been successfully deleted. ').and_return('OK')
        request_params = { id: 1, assignment_id: 1 }
        post :destroy, params: request_params
        expect(flash[:error]).to eq('The topic could not be deleted.')
        expect(response).to redirect_to('/assignments/1/edit')
      end
    end
  end

Test the UI for the deployed project.

UI Testing

Instructor View

  • username: instructor6
  • password: password

Student View

  • username: student575
  • password: password

View bidding details

  1. Log into expertiza as Instructor
  2. Go to Topics page
  3. Once the Topics page shows up, verify the bidding details for each Topic on the table
  4. Impersonate a Student to verify if the team/student was actually bidding for the Topic

Future Work

  • Place holder for potential ed-cases that might get missed

Team Roster

Mentor: Ed Gehringer - efg@ncsu.edu

  • Duy Nguyen - dvnguye3@ncsu.edu
  • Kwon HyeokJun - khyeokj@ncsu.edu
  • Shawn Salekin - ssaleki@ncsu.edu
  • David Glymph - dwglymph@ncsu.edu

Reference

  1. Previous works
  2. Team code repo
  3. Upstream code repo