Giter Site home page Giter Site logo

maxwellbo / suq Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 0.0 14.7 MB

🔁 SyncUQ is a University of Queensland exclusive schedule sharing SPA.

Home Page: https://www.syncuq.com/

License: GNU General Public License v3.0

Python 36.42% JavaScript 3.01% HTML 14.12% Elm 29.41% CSS 16.91% Shell 0.13%
university uq timetable-management

suq's Introduction

Mobile app mockups

SyncUQ aims to be the first University of Queensland exclusive schedule sharing platform. Users will be able to share their timetables with friends and get live updates of when their friends are free. It also has the bonus functionality of allowing users to plan meetings with one another.

Demo

syncuq.com

Requirements

  • Python 3.6
  • Docker
  • Heroku
  • Ruby

Configuration

Setting up the Python Sandbox

  • python3 -m venv .venv
  • source .venv/bin/activate
  • pip3 install -r ./requirements.txt

Configuring the environment

  • export FLASK_DEBUG=1
  • export FLASK_APP=app.py

Configuring the Database

  • docker run --name suq_db -d -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:9.6.2

Downloading development dependencies

  • sudo gem install sass

Development

Usage

  • ./run.sh to compile the frontend and boot a development Flask instance, not using Gunicorn

Migrate DB

To migrate the db, all you have to do is make changes like you normal would to the models.py file. Then run

  • flask db migrate to generate a migration file and
  • flask db upgrade to change the db to the new schema

now the db should be properly formatted and work.

Migrate DB server side

Run

  • heroku run bash --app syncuq-stage to get into bash on heroku

then inside bash

  • export FLASK_APP=app.py

then, assuming you have pushed the migrations file created from migrating locally, just run this command to get the server side db to upgrade

  • flask db upgrade

if something goes wrong, there is a good chance you can fix it by running the following

  • rm -r migrations delete the migrations folder
  • flask db init remake the migrations folder
  • flask db migrate create the migration
  • flask db upgrade perform the migration

Precommit

To typecheck:

  • mypy run.py

Links

suq's People

Contributors

charltongroves avatar hugokawamata avatar maxwellbo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

suq's Issues

Refactor landing.css

Landing.css has all the styling for the app in it, as well as the styling for the landing page.
the app's style stuff should be removed.

Alternatively, as app.css and landing.css share a lot of the same styles, they should both have similar styles abstracted out of them into a main.css file. This sheet should then be prepended to the html in both pages, allowing both pages to share the style

Rewrite README.md

  • Add Charlie's design prototypes (put them in /docs)
  • Friendly description of the app
  • Logo that isn't white (for use on a white background)

Database Migrations

Before we continue, we desperately need to have a database migration workflow. By migrating the db instead of drop_all() create_all(), we can preserve users data and allow our current users to not have to reupload their timetable.

Create mock testing data

Testing end points on heroku is disgusting. We need some mock users complete with fake FB user IDs and fake FB user id friends.

After this we can properly test new features locally without fear of destroying our heroku db's

Fix Elm style issues

f <| g <| x y is wrong, it should be f << g <| x y

f <| (x) is also wrong. It should be f <| x

User Friends

Add the functionality for adding and removing friends.

Requirements:
User must approve people who add them
User can remove friends from their friendslist
User can send a friend request to other users.

Idea:
Set up the table as follows

User sending | User Recieving | Accepted

eg. User 11111 sends user 11112 a friend request but user 2 has not accepted
11111 | 11112 | False

eg. User 2222 and user 3333 are friends
2222 | 3333 | True
3333 | 2222 | True
(the reason as to why we have two rows in the db for one friend connection, is that it allows us to easily query just 1 column to find all of the users friends)

  • Build db schema
  • Friend request route
  • Friend accept route
  • Search Facebook Friends route
  • Frontend list all users and add friends
  • Frontend accept users
  • Frontend remove users
  • Frontend User Search

Shitpostify all error messages

because having a hearty chuckle is more important than maintainability.

If a function throws an error, replace the error message with
"uhhhhhHhhhhh {function name} machine broke"

If something on the db breaks, log
"uhhhhHhhhhh database machine broke"

Rename repository to `suq`

This may require recloning recloning the repo on all development machines, altering the referenced repository in elm-package.json and changing the repository that Heroku attempts to clone and build.

Login Page

The current login page is trash.

We need to remove the old login form (Keep a copy of it on the repo, we will need it for later iterations), and we need to make it look pretty/match the a e s t h e t i c of the rest of the app.

It should have the log in via facebook button nice and big, and include little message below the button explaining how we will never post to your wall or do anything naughty.

Add proposal documents to `/docs`

  • Group proposal as docs/Group_Proposal.pdf
  • Max's Proposal as docs/Max_Proposal.pdf
  • Hugo's Proposal as docs/Hugo_Proposal.pdf
  • Charlie's Proposal as docs/Charlie_Proposal.pdf

Static assets aren't getting served

bulma.css Failed to load resource: the server responded with a status of 404 (NOT FOUND)
/style.css Failed to load resource: the server responded with a status of 404 (NOT FOUND)
syncuqlogo.png Failed to load resource: the server responded with a status of 404 (NOT FOUND)
screenshot-desktop.png Failed to load resource: the server responded with a status of 404 (NOT FOUND)
screenshot-mobile.png Failed to load resource: the server responded with a status of 404 (NOT FOUND)
style.css Failed to load resource: the server responded with a status of 404 (NOT FOUND)
bulma.css Failed to load resource: the server responded with a status of 404 (NOT FOUND)

"What's Due" Tab

So, this is what we get if we hit https://syncuq-stage.herokuapp.com/whats-due

{
  "data": [
    [
      "INFS3202 - Sem 1 2017 - St Lucia - Internal", 
      "Project Individual Assignment", 
      "18 Mar 2017: 23:59", 
      "5%"
    ], 
    ...
    [
      "INFS3202 - Sem 1 2017 - St Lucia - Internal", 
      "Online Quiz Online QUIZ", 
      "13 Mar 17  - 2 Jun 17 23:00", 
      "15%"
    ],
    ...
    [
      "INFS3202 - Sem 1 2017 - St Lucia - Internal", 
      "Exam - during Exam Period (Central) Final Exam", 
      "Examination Period", 
      "55%"
    ], 
    ...
    
  ]
}
  • We need the server to cull the first one (because it's already happened)
  • We need the second to stay (because we're still before it's end date)
  • We need the last one to go to the end of the list, along with all the other examination periods
  • We need a pretty way of viewing these on the frontend

Landing Page

We need a good looking landing page that exists at syncuq.com/

It should look damn good, and succinctly tell users what the app does.

Front and center should be a login via facebook button that takes the user to the /app

Debug pop up

So we have a models.status field in our frontend, where all our errors get dumped to. It would be nice that whenever it got updated, there'd be some sort of pop up or bar that contained the status message. This might allow us to complete #40.

Slideshow

Probably best to use the Beamer template.

The .tex file and compiled .pdf should probably go in /docs/

Add better logging

  • Give the whole program a pass to ensure that we have logging invocations in all things that we ideally should know are happening
  • Ensure that pre-existing logging messages are logging with the correct semantic value

Fix all issues reported by `mypy`

Currently, the following errors are reported

(.venv) ~/s/suq_backend ❯❯❯ mypy app.py suq/models.py suq/responses.py
app.py:11: error: No library stub file for module 'flask'
app.py:11: note: (Stub files are from https://github.com/python/typeshed)
app.py:14: error: No library stub file for module 'sqlalchemy.ext.declarative'
app.py:16: error: Cannot find module named 'flask_login'
app.py:16: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
app.py:17: error: Cannot find module named 'flask_migrate'
suq/models.py:11: error: No library stub file for module 'flask_sqlalchemy'
suq/models.py:12: error: Cannot find module named 'flask_login'
suq/models.py:17: error: No library stub file for module 'bs4'
suq/responses.py:14: error: No library stub file for module 'flask'
suq/models.py:28: error: Invalid type "suq.models.db"
suq/models.py:28: error: Invalid base class
suq/models.py:175: error: Need type annotation for variable
suq/models.py:195: error: Need type annotation for variable
suq/models.py:399: error: Too few arguments for "get_user_status"

However, with more aggressive options

(.venv) ~/s/suq_backend ❯❯❯ mypy . --strict                        ⏎ master ✭ ◼
suq/models.py:11: error: No library stub file for module 'flask_sqlalchemy'
suq/models.py:11: note: (Stub files are from https://github.com/python/typeshed)
suq/models.py:12: error: Cannot find module named 'flask_login'
suq/models.py:12: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help)
suq/models.py:17: error: No library stub file for module 'bs4'
suq/responses.py:14: error: No library stub file for module 'flask'
suq/test.py:2: error: Cannot find module named 'models'
app.py:11: error: No library stub file for module 'flask'
app.py:14: error: No library stub file for module 'sqlalchemy.ext.declarative'
app.py:16: error: Cannot find module named 'flask_login'
app.py:17: error: Cannot find module named 'flask_migrate'
suq/responses.py:25: error: Function is missing a type annotation
suq/responses.py:67: error: Function is missing a type annotation for one or more arguments
suq/responses.py:73: error: Function is missing a type annotation for one or more arguments
suq/responses.py:77: error: Function is missing a type annotation for one or more arguments
suq/test.py:8: error: Function is missing a type annotation
suq/test.py:14: error: Function is missing a type annotation
suq/test.py:20: error: Function is missing a type annotation
suq/test.py:27: error: Function is missing a type annotation
suq/test.py:36: error: Function is missing a type annotation
suq/test.py:46: error: Function is missing a type annotation
suq/test.py:56: error: Function is missing a type annotation
suq/models.py:28: error: Invalid type "suq.models.db"
suq/models.py:28: error: Invalid base class
suq/models.py:28: error: Class cannot subclass 'UserMixin' (has type 'Any')
suq/models.py:43: error: Function is missing a type annotation
suq/models.py:81: error: Function is missing a type annotation
suq/models.py:82: error: Call to untyped function "generate_password_hash" in typed context
suq/models.py:84: error: Function is missing a type annotation
suq/models.py:85: error: Call to untyped function "check_password_hash" in typed context
suq/models.py:134: error: Function is missing a type annotation for one or more arguments
suq/models.py:142: error: Function is missing a type annotation for one or more arguments
suq/models.py:175: error: Need type annotation for variable
suq/models.py:193: error: Function is missing a return type annotation
suq/models.py:195: error: Need type annotation for variable
suq/models.py:265: error: Function is missing a type annotation
suq/models.py:268: error: Call to untyped function "concat" in typed context
suq/models.py:291: error: Incompatible return value type (got None, expected "Event_")
suq/models.py:298: error: Incompatible return value type (got None, expected "Break")
suq/models.py:301: error: Function is missing a return type annotation
suq/models.py:305: error: Function is missing a type annotation
suq/models.py:310: error: Call to untyped function "make_user_status" in typed context
suq/models.py:322: error: Call to untyped function "make_user_status" in typed context
suq/models.py:327: error: Call to untyped function "make_user_status" in typed context
suq/models.py:332: error: Call to untyped function "make_user_status" in typed context
suq/models.py:338: error: Call to untyped function "make_user_status" in typed context
suq/models.py:354: error: Function is missing a type annotation
suq/models.py:399: error: Too few arguments for "get_user_status"
app.py:12: note: unused 'type: ignore' comment
app.py:38: error: Call to untyped function "create_engine" in typed context
app.py:71: error: Function is missing a type annotation
app.py:73: error: Function is missing a type annotation
app.py:79: error: Function is missing a type annotation
app.py:88: error: Function is missing a type annotation
app.py:94: error: Function is missing a type annotation
app.py:101: error: Function is missing a type annotation
app.py:110: error: Function is missing a type annotation
app.py:120: error: Function is missing a type annotation
app.py:133: error: Function is missing a type annotation
app.py:137: error: Function is missing a type annotation
app.py:147: error: Call to untyped function "get_whats_due" in typed context
app.py:151: error: Function is missing a type annotation
app.py:161: error: Function is missing a type annotation
app.py:172: error: Call to untyped function "check_password" in typed context
app.py:182: error: Function is missing a type annotation
app.py:190: error: Call to untyped function "User" in typed context
app.py:200: error: Function is missing a type annotation
app.py:210: error: Function is missing a type annotation
app.py:224: error: Function is missing a type annotation
app.py:235: error: Function is missing a type annotation
app.py:255: error: Function is missing a type annotation
app.py:265: error: Function is missing a type annotation
app.py:289: error: Function is missing a type annotation
app.py:290: error: Call to untyped function "redirect_url" in typed context
app.py:299: error: Function is missing a type annotation
app.py:312: error: Function is missing a type annotation
app.py:321: error: Call to untyped function "User" in typed context
app.py:357: error: Function is missing a type annotation
app.py:363: error: Function is missing a type annotation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.