Skip to content
This repository was archived by the owner on Jun 11, 2020. It is now read-only.

conor-smith/3403Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

3403Project

Introduction

Context

The purpose of this website is for users to rank movies preferentially and then compare their rankings against everyone else in the website. The main theme we had in mind when creating this website was avoiding choice paralysis. This website would be curated by small team with only a few (<=10) polls available to vote on at one time. These polls would be rotated out regularly (weekly, biweekly, etc.), replaced with new polls created by the admin team. To avoid dissatisfaction from the userbase due to movies they believe should be included, the movies in the polls should be chosen based on a mix of critical reception and/or audience reception. More specific topics are also great for avoiding this issue as the likely candidate pool would shrink (e.g: The best movie of 2019 vs The best movie sound design of 2019). This would also get users thinking more deeply about movies. Sidenote: We had initially intended to rank multiple forms of media (movies, music and games) but we scaled down due to time constraints and overcomplexity. This is why in the code, we refer to movies as media. TODO explain social mechanism/voting mechanism used.

Voting Mechanism

The voting page for each poll consists of a set of all the movie "posters", or which may be dvd covers or images of the actual movie posters. The user selects them in the order they feel best fits the poll. (eg: For the best sci-fi horror poll, I select Event Horizon first, followed by Alien, etc). To prevent confusion, when an option is selected, it disappears, meaning it can not be selected again or unselected. If the user is unhappy with their choices, they may choose to participate again. Doing so will remove all all their previous votes for that particular poll before starting. Each movie is assigned a number when the user votes for them, from 1 to however many movies are in the poll (no more than 10). Once this has been done. The data is stored in a votes table. These votes can be aggregated to produce the global results for a particular poll.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes (tested on Linux and macOS).

Prerequisites

While in your virtual environment, install the following:

Installing

You will need to be in a virtual environment whenever you run the server or follow the below instructions. You can run it without one, but we are not responsible if anything goes wrong.

Step 1 Creating a python virtual environment

Use the following commands:

  1. Virtualenv venv
  2. source venv/bin/activate
  3. pip install -r requirements.txt

Step 2. Initializing the database

Use the following commands:

  1. flask db init
  2. flask db migrate
  3. flask db upgrade

Step 3. Adding an admin account

  • Open add_admin.py and replace 'admin' in u = User(username='admin', admin = 1) with your desired username and replace 'admin' in u.set_password('admin') with your desired password
  • Then use python add_admin.py to add the admin account

Once you have added the first admin account, adding further admin accounts is made easy using the User page of the admin view of the website.

Step 4. Starting then server

Simply use flask run to start the server. You can then head to localhost:5000 or 127.0.0.1:5000 to see the website in action.

Running the tests

To run the unit tests, use python testing.py When the unit tests are finished you will need to:

  • flask db migrate
  • flask db upgrade

to rebuild the database.

Break down into end to end tests

User function tests

  • test_set_password
    • Tests ability to assign and hash a password to a user
  • test_delete_account
    • Tests ability to delete a user
  • test_already_voted
    • Tests ability to check if a user has already voted on the poll passed to the function
  • test_remove_user_poll
    • Tests ability to remove previous votes made on the poll passed to the function
  • test_all_polls
    • Tests ability to return all polls a user has participated in
  • test_poll_results
    • Tests ability to return results of a poll if the user has participated in it

Poll function tests

  • test_add_media
    • Tests ability to add media to a poll
  • test_remove_media
    • Tests ability to remove media from a poll
  • test_voters
    • Tests ability to return all participants of a poll
  • test_totals
    • Tests ability to return global (multiuser) rankings of a poll
  • test_contains
    • Tests ability to chcek if a poll contains a certain media
  • test_cover
    • Tests ability to return the first movie poster of a poll
  • test_close_all
    • Tests ability to deactivate all active polls (i.e. archive polls)

Routes function tests

  • test_front
    • Tests that the front page functions
  • test_about_us
    • Tests that the about us page functions
  • test_login_logout
    • Tests that the login and logout functionality works
  • test_archives
    • Tests that the archives page doesn't allow users not logged in
  • test_register
    • Tests that the register page functions
  • test_missing
    • Tests that the 404 page displays properly

Built With

  • Bootstrap - Javascript Library
  • Jquery - Javascript Library
  • Flask - Web Framework
  • and of course good 'ol HTML, CSS and Javascript

Authors

  • Billtone Mey Oum (21806052) - Initial work - billmey
  • Conor Smith (21959981) - Initial work - conor-smith

License

This project is licensed under the GNU General Public License v3.0 or later - see the LICENSE.md file for details

Acknowledgments

Commit Logs

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published