forked from lwerdna/bugtrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Db.py
86 lines (74 loc) · 2.91 KB
/
Db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# this defines the abstract interface that the other parts of bugtrack
# expect to interact with whatever method is used to store shit
# so like if you have an sqlite backend, you should implement dbSqlite,
# inheriting from this, implementing the methods
# initially, I'll make a model dbText, which uses simple text files for
# storage....
class Db(object):
#--------------------------------------------------------------------------
# general info
#--------------------------------------------------------------------------
# return list of players
def getPlayerList(self):
pass
#--------------------------------------------------------------------------
# get player stats
#--------------------------------------------------------------------------
# get the player's rating
def getPlayerRating(self, name):
pass
# get the player's RD
def getPlayerRD(self, name):
pass
# get the player's last time played
def getPlayerT(self, name):
pass
# return a list [rating, RD, tLastPlayed]
def getPlayerStats(self, name):
pass
#--------------------------------------------------------------------------
# set player stats
#--------------------------------------------------------------------------
def addPlayer(self, name, rating, rd):
pass
def setPlayerRating(self, name, r):
pass
def setPlayerRD(self, name, rd):
pass
def setPlayerStats(self, name, listStats):
pass
#--------------------------------------------------------------------------
# game stats
#--------------------------------------------------------------------------
# returns a row from the database - currently we define row as:
# [date, teamAwhitePlayer, teamAwhitePlayerRating,
# teamAblackPlayer, teamAblackPlayerRating,
# teamBwhitePlayer, teamBwhitePlayerRating,
# teamBblackPlayer, teamBblackPlayerRating]
#
# where, by convention, teamA are the winners, teamB are the losers
#
# (change this comment if the db schema changes please)
def getGames(self, since):
pass
# retrieve all games that had player involved in it
def getGamesByPlayer(self, name, since):
pass
def recordGame(self, data):
pass
# game is uniquely identified by t
def modifyGame(self, t, teamAWhite, tawRating, teamABlack, tabRating, \
teamBWhite, tbwRating, teamBBlack, tbbRating):
pass
#--------------------------------------------------------------------------
# setup/testing stuff
#--------------------------------------------------------------------------
# this should create whatever files or dependencies are necessary for this
# db implementation to work...
#
# for example. DbText creates players.dat and games.dat
#
def init(self):
pass
def clear(self):
pass