Giter Club home page Giter Club logo

tradeassist's Introduction

Magic Trade Assist

Providing a (mobile) webservice to compare prices of Magic cards. You can see it live on http://tradeassi.st

Setup

The code should work out of the box, but you need some data to do anything useful! In order to get this data, you should set up a MySQL server and create some tables.

Card information will be stored in the cards table:

CREATE TABLE cards
(
    id INT UNSIGNED NOT NULL,
    name VARCHAR(120) DEFAULT '' NOT NULL,
    name_de VARCHAR(200) DEFAULT '' NOT NULL,
    name_us VARCHAR(200) DEFAULT '' NOT NULL,
    img_url VARCHAR(200) DEFAULT '' NOT NULL,
    edition SMALLINT UNSIGNED NOT NULL,
    rarity VARCHAR(1) DEFAULT '' NOT NULL,
    rate DECIMAL(8,2) NOT NULL,
    rate_us DECIMAL(8,2) NOT NULL,
    rate_foil DECIMAL(8,2) NOT NULL,
    rate_foil_us DECIMAL(8,2) NOT NULL,
    minprice DECIMAL(8,2) NOT NULL,
    minprice_us DECIMAL(8,2) NOT NULL,
    minprice_foil DECIMAL(8,2) NOT NULL,
    timestamp_mkm TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
    timestamp_us TIMESTAMP DEFAULT '0000-00-00 00:00:00' NOT NULL
);
CREATE UNIQUE INDEX id ON cards ( id );
CREATE INDEX cardname ON cards ( name, name_de );

Each card belongs to an edition:

CREATE TABLE editions
(
    id SMALLINT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
    edition VARCHAR(255) DEFAULT '' NOT NULL,
    shortname VARCHAR(5) DEFAULT '' NOT NULL,
    mkm_name VARCHAR(255) DEFAULT '' NOT NULL,
    us_name VARCHAR(255) DEFAULT '' NOT NULL,
    isregular BIT DEFAULT 1 NOT NULL
);
CREATE UNIQUE INDEX shortname ON editions ( shortname );

Trades can be saved in the export table:

CREATE TABLE export
(
    id INT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
    cardlists LONGTEXT NOT NULL,
    md5 VARCHAR(32) NOT NULL,
    timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX md5 ON export ( md5 );

Filling these tables with meaningful data is left as an exercise to the reader.

Developing

In order to easily make changes to the JS / CSS files, you need to run Coffeescript and SCSS/SASS so that they will automatically compile the .coffee and .scss files in sources. When the server is not running on the configured HOSTNAME, the main page will try to load all assets from that folder, allowing you to easily modify the code and reload the page without having to redeploy every time you change something.

SASS

Run sass --sourcemap --watch sources in the project root folder.

Coffee

Run coffee -m -b -c -w sources in the project root folder.

Deploying

To update the static CSS / JS assets, simply run ./deploy.sh, which will generate the tradeassist.js and tradeassist.css

License

Copyright (c) 2013 Steffen Baumgart
See the LICENSE file for details.

tradeassist's People

Contributors

bra1n avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

moneta-work

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.