This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" Generates SQL tables for Cards and Rows """ | |
from django.db import models | |
class Card(models.Model): | |
""" A bingo card with 5 rows. """ | |
created_on = models.DateTimeField(auto_now_add=True) | |
def __str__(self): | |
return "Card: " + str(self.id) + ", " + str(self.created_on) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" These are endpoints that get or create cards and rows """ | |
from rest_framework import generics | |
from play.models import Card | |
from play.serializers import CardSerializer | |
class CardList(generics.ListCreateAPIView): | |
""" Get or create cards """ | |
queryset = Card.objects.all() | |
serializer_class = CardSerializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<!-- keep the old stuff --> | |
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" /> | |
<head> | |
<!-- keep the old stuff --> | |
<footer class="text-center pt-3"> | |
<p class="d-flex flex-row justify-content-center"> | |
<a href="https://medium.com/@ryan.dines" target="_top">Brought to you with | |
<span class="fa fa-heart crimson"></span> | |
by Ryan Dines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.ticket-number { | |
margin: 1px; | |
color: black; | |
background: #defffd; | |
} | |
.called { | |
transition: all .5s ease-in-out; | |
background: #076461; | |
color:white; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# keep Card and Row models from before | |
class Ball(models.Model): | |
""" | |
The ball in a ball-blower. Represents a random number 1-75. | |
""" | |
num_value = models.CharField(max_length=3) | |
updated_at = models.DateTimeField(auto_now=True) | |
class MatchSmiley(models.Model): | |
""" Derived from card data, each column is a number on a specific card""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
We have 4 models that interact with each other to form the game play. | |
The card and row tables will form the data for the bingo cards. | |
The match_smiley table is populated from the card/row tables, where each column is a certain number on the card, | |
so the row would be the group of numbers that make a smiley-face. | |
We'll decrement the 'left' property of match_smiley as balls are called that match. | |
""" | |
from django.db import models | |
# keep Card and Row models from before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by Django 2.2.4 on 2019-08-19 15:30 | |
from django.db import migrations | |
def seed_database(apps, _): | |
""" Seed the ball numbers into the database """ | |
balls = apps.get_model('play', 'Ball') | |
balls.objects.all().delete() | |
for i in range(1, 76): | |
data = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" urls for playing bingo """ | |
from django.urls import path | |
from play.views import CardList, BallList, reset_balls | |
urlpatterns = [ | |
path('cards/', CardList.as_view(), name='cards'), | |
path('balls/', BallList.as_view(), name='balls'), | |
path('reset_balls/', reset_balls, name='reset_balls') | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import styled from 'styled-components'; | |
import { connect } from 'react-redux'; | |
// tslint:disable-next-line: no-submodule-imports | |
import 'bootstrap/dist/css/bootstrap.css'; | |
import { Flex } from 'rebass'; | |
import { Container, Row } from 'reactstrap'; | |
import { IApplicationState, IConnectedReduxProps } from '../store/configureStore'; | |
import { danger, clear } from '../store/messages'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"defaultSeverity": "error", | |
"extends": [ | |
"tslint-react" | |
], | |
"jsRules": { | |
}, | |
"rules": { | |
"member-access": false, | |
"ordered-imports": false, |
OlderNewer