def add_member(self, member): """Adds member obj to a team""" self.member_list.append(member) DB.create_member_record(self.id, member.get_id())
def remove_member(member): DB.delete_member_record(member.get_id())
def get_team_by_name(cls, team_name): """Returns team object by name""" args = DB.read_team_record_by_name(team_name) if args: return cls(*args[0]) return None
def add_team(cls, name): """Add new team to data base and return team object""" new_team_id = DB.create_team(name) new_team = cls.get_team_by_id(new_team_id) return new_team
def member_list(self): return User.get_user_list_by_id_list( DB.read_user_id_list_by_team_id(self.id))
def create_team_by_id(cls, team_id): """Return team object by provided id""" args = DB.read_team_record_by_id(team_id) return cls(*args[0])
def assignment_remove(assignment_id): DB.delete_assignment_record(assignment_id) return redirect(url_for('assignments_ctrl.assignments'))
def remove_assignment(): assignment_id = request.get_json() DB.delete_assignment_record(assignment_id) return ''
from memo import Memo import file_saver from db_controller import DB import file_reader import telebot from telebot import types import keyboards import datetime import time import threading bot = telebot.TeleBot(config.TOKEN) db = DB('./data/memos.db') db.create_table() memo_name = {} test_notify_delta = [ datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5), datetime.timedelta(hours=0, minutes=0, seconds=5) ] notify_delta = [ datetime.timedelta(hours=0, minutes=0, seconds=5),
def set_status(self, new_status): """Sets new status of students attendance""" self.status = new_status DB.update_attendance(self.student.get_id(), self.get_date(), new_status)
def add_attendance(cls, student_id, date, status): status_dict = {'0': 0, '1': 1, '0.8': 0.8} values = (student_id, date, status_dict[status]) new_attendance_id = DB.create_attendance_record(values) new_attendance = cls.get_attendance_by_id(new_attendance_id) return new_attendance
def update_attendance(cls, student_id, date, status): """ Updates attendance """ return DB.update_attendance(student_id, date, status)
def create_all_overall_attendance(cls): """ Creates all students overall attendance :return: overall attendance: float """ return DB.read_all_overall_attendance()