Aufgrund einer Störung des s3 Storage, könnten in nächster Zeit folgende GitLab Funktionen nicht zur Verfügung stehen: LFS, Container Registry, Job Artifacs, Uploads (Wiki, Bilder, Projekt-Exporte). Wir bitten um Verständnis. Es wird mit Hochdruck an der Behebung des Problems gearbeitet. Weitere Informationen zur Störung des Object Storage finden Sie hier:

Aufgrund einer Wartung wird GitLab am 03.08. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 03.08. between 8:00 and 9:00 am.

Commit 036215ba authored by LammLukas's avatar LammLukas
Browse files

Implemented room template export using sqlite database

parent 23d7f47a
......@@ -4,6 +4,8 @@ Class for room objects.
Author: L. Lamm (
from src.Exportable import Exportable
from src.Exceptions import *
import sqlite3
class Room(Exportable):
......@@ -24,10 +26,27 @@ class Room(Exportable):
if not hasattr(self, 'AssignedParticipants'):
self.AssignedParticipants = assigned_participants
def save_template(self, file, append=False):
"""Save template for room"""
data = self.data2dict(export_list=['Name', 'Internal_ID', 'NumSeats'])
self.write_json(file, data)
def save_template(self, file='./templates/rooms/room_templates.db'):
"""Save template for room in database"""
connector = sqlite3.connect(file)
cursor = connector.cursor()
"Check if table exists in database"
cursor.execute(" SELECT count(name) FROM sqlite_master WHERE type='table' AND name='rooms'")
if not cursor.fetchone()[0] == 1:
cursor.execute("CREATE TABLE rooms (internal_ID text, name text, num_seats text)")
"Check if room with id already exists"
cursor.execute("SELECT name FROM rooms WHERE internal_ID = ?", [self.Internal_ID])
if cursor.fetchone() is not None:
raise TemplateAlreadyExists("Room template already exists in database!")
values = [self.Internal_ID, self.Name, self.NumSeats]
cursor.execute("INSERT INTO rooms VALUES (?, ?, ?)", values)
def load_template(self, file):
"""Load template for room"""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment