Parts Implemented by Abdullah Buldur

Models

final4.models.award

Award class and Database connection handlers

class final4.models.award.Award(name, _id=None)

Award object

getAttrs()

returns attributes of the Award class as a dictionary. Keys are taken from the awardtable and corresponding values are taken from the Award object attributes.

Returns:attributes of the Award object as a dictionary.
Return type:dict
class final4.models.award.Awards(conn, cur)

the Awards object provides functions for database connections of awards table.

Parameters:
  • conn – psycopg2 connection object
  • cur – psycopg2 cursor object
add_award(award)

inserts a new row to the awards table with values of the given award attributes.

Parameters:award – new Award object
delete_award(_id)

deletes the row from the awards table whose id is given _id.

Parameters:_id – id of the row - int
get_award(_id)

Returns final4.models.award.Award object with values from the awards table IF there is a record has a given _id ELSE returns None.

Parameters:_id – id of the row - int
Returns:award or None
Return type:final4.models.award.Award object or None
get_awards(limit=100, offset=0)

Returns result list and total number of results. Returning list is list of final4.models.award.Award object. All objects filled up with values from the rows of the awards table. Also returns the total number of the result.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardlist, total

Return type:

list, int

get_awards_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.award.Award object. All objects filled up with values from the rows of the awards table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardlist, total

Return type:

list, int

get_awards_search_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.award.Award object. All objects filled up with values from the rows of the awards table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardlist, total

Return type:

list, int

update_award(_id, new)

Updates the row from the awards table whose id is given _id. The new values is taken from given new Award object.

Parameters:
  • _id – id of the row - int
  • new – Award object with new values

final4.models.award_stat

Award_stat class and Database connection handlers

class final4.models.award_stat.AwardStat(award_id, player_id, season_id, award_name=None, player_name=None, player_surname=None, season_year=None, _id=None)

Awartstat object

getAttrs()

returns attributes of the Awardstat class as a dictionary. Keys are taken from the awardstattable and corresponding values are taken from the Awardstat object attributes.

Returns:attributes of the Awardstat object as a dictionary.
Return type:dict
class final4.models.award_stat.AwardStats(conn, cur)

the Awardstats object provides functions for database connections of awardstats table.

Parameters:
  • conn – psycopg2 connection object
  • cur – psycopg2 cursor object
add_award_stat(award_stat)

inserts a new row to the awardstats table with values of the given awardstat attributes.

Parameters:awardstat – new Awardstat object
delete_award_stat(_id)

deletes the row from the awardstats table whose id is given _id.

Parameters:_id – id of the row - int
get_award_stat(_id)

Returns final4.models.awardstat.Awardstat object with values from the awardstats table IF there is a record has a given _id ELSE returns None.

Parameters:_id – id of the row - int
Returns:awardstat or None
Return type:final4.models.awardstat.Awardstat object or None
get_award_stats(limit=100, offset=0)

Returns result list and total number of results. Returning list is list of final4.models.awardstat.Awardstat object. All objects filled up with values from the rows of the awardstats table. Also returns the total number of the result.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardstatlist, total

Return type:

list, int

get_award_stats_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.awardstat.Awardstat object. All objects filled up with values from the rows of the awardstats table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardstatlist, total

Return type:

list, int

get_award_stats_search_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.awardstat.Awardstat object. All objects filled up with values from the rows of the awardstats table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

awardstatlist, total

Return type:

list, int

update_award_stat(_id, new)

Updates the row from the awardstats table whose id is given _id. The new values is taken from given new Awardstat object.

Parameters:
  • _id – id of the row - int
  • new – Awardstat object with new values

final4.models.match

Match class and Database connection handlers

class final4.models.match.Match(schedule_id, T1_3PT, T1_2PT, T1_block, T1_reb, T1_rate, T2_3PT, T2_2PT, T2_block, T2_reb, T2_rate, T1_name=None, T2_name=None, _id=None)

Match object

getAttrs()

returns attributes of the Match class as a dictionary. Keys are taken from the matchtable and corresponding values are taken from the Match object attributes.

Returns:attributes of the Match object as a dictionary.
Return type:dict
class final4.models.match.Matches(conn, cur)

the Matches object provides functions for database connections of matches table.

Parameters:
  • conn – psycopg2 connection object
  • cur – psycopg2 cursor object
add_match(match)

inserts a new row to the matches table with values of the given match attributes.

Parameters:match – new Match object
delete_match(_id)

deletes the row from the matches table whose id is given _id.

Parameters:_id – id of the row - int
get_match(_id)

Returns final4.models.match.Match object with values from the matches table IF there is a record has a given _id ELSE returns None.

Parameters:_id – id of the row - int
Returns:match or None
Return type:final4.models.match.Match object or None
get_matches(limit=100, offset=0)

Returns result list and total number of results. Returning list is list of final4.models.match.Match object. All objects filled up with values from the rows of the matches table. Also returns the total number of the result.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

matchlist, total

Return type:

list, int

get_matches_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.match.Match object. All objects filled up with values from the rows of the matches table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

matchlist, total

Return type:

list, int

get_matches_search_by(attrib, search_key, limit=100, offset=0)

Returns result list and total number of result. Returning list is list of final4.models.match.Match object. All objects filled up with values from the rows of the matches table.

The return list made up by filtered results with given parameters.

Parameters:
  • limit – maximum number of the result
  • offset – skip beginning of the result
Returns:

matchlist, total

Return type:

list, int

update_match(_id, new)

Updates the row from the matches table whose id is given _id. The new values is taken from given new Match object.

Parameters:
  • _id – id of the row - int
  • new – Match object with new values

Views

final4.views.award_view

final4.views.award_view.award_from_id(award_id)

Routing function for getting award from its id.

GET request returns JSON object.

POST request updates award which has id equal to the lid with the values recieved from the request.form. After all it renders awards.html

Parameters:lid – id of the award, int
final4.views.award_view.award_page()

Routing function for award-table page.

This page has session control. see session controlled pages

This page lists awards and allows adding, deleting, and updating on them.

final4.views.award_view.awards_home()

This view page list all awards in awards table. This page doesn’t allow editing.

final4.views.award_view.search_award(key)

Routing function for search award by its name.

GET request renders the awards.html with awards comes from the search result.

final4.views.award_view.view_award(award_id)

Routing function for award info page.

It renders the award_page.html with related statistical information.

final4.views.award_stat_view

final4.views.award_stat_view.award_stat_from_id(award_stat_id)

Routing function for getting award_stat from its id.

GET request returns JSON object.

POST request updates award_stat which has id equal to the lid with the values recieved from the request.form. After all it renders award_stats.html

Parameters:lid – id of the award_stat, int
final4.views.award_stat_view.award_stat_page()

Routing function for award_stat-table page.

This page has session control. see session controlled pages

This page lists awardstats and allows adding, deleting, and updating on them.

final4.views.award_stat_view.award_stats_home()

This view page list all award_stats in award_stats table. This page doesn’t allow editing.

final4.views.award_stat_view.search_award_stat(key)

Routing function for search award_stat by its name.

GET request renders the award_stats.html with award_stat comes from the search result.

final4.views.award_stat_view.view_award_stat(award_stat_id)

Routing function for award_stat info page.

It renders the award_stat_page.html with related statistical information.

final4.views.match_view

final4.views.match_view.get_match_from_id(match_id)

Routing function for getting match from its id.

GET request returns JSON object.

POST request updates match which has id equal to the lid with the values recieved from the request.form. After all it renders matches.html

Parameters:lid – id of the match, int
final4.views.match_view.match_page()

Routing function for match-table page.

This page has session control. see session controlled pages

This page lists matches and allows adding, deleting, and updating on them.

final4.views.match_view.matches_home()

This view page list all matches in matches table. This page doesn’t allow editing.

final4.views.match_view.search_match(key)

Routing function for search match by its name.

GET request renders the matches.html with matches comes from the search result.

final4.views.match_view.view_match(match_id)

Routing function for match info page.

It renders the match_page.html with related statistical information.