def delete_skema(): no_skema = request.form['no_skema'] sql = "UPDATE skema SET delete_status = 1 WHERE no_skema = '" + no_skema + "' RETURNING no_skema;" result = connect(sql, 'PUT') return str(result)
def delete_nilai(): id_hasil = request.form['id_hasil'] sql = "UPDATE hasil SET delete_status = 1 WHERE id_hasil = '" + id_hasil + "' RETURNING id_hasil;" result = connect(sql, 'PUT') return str(result)
def delete_peserta(): no_peserta = request.form['no_peserta'] sql = "UPDATE peserta SET delete_status = 1 WHERE no_peserta = '" + no_peserta + "' RETURNING no_peserta;" no_peserta = connect(sql, 'PUT') return str(no_peserta)
def create_skema(): nama_skema = request.form['nama_skema'] ruang = request.form['ruang'] sql = "INSERT INTO skema(nama_skema, ruang, delete_status) VALUES('" + nama_skema + "', '" + ruang + "', '0') RETURNING no_skema;" result = connect(sql, 'POST') return str(result)
def update_skema(): no_skema = request.form['no_skema'] nama_skema = request.form['nama_skema'] ruang = request.form['ruang'] sql = "UPDATE skema SET nama_skema = '" + nama_skema + "', ruang = '" + ruang + "', delete_status = 0 WHERE no_skema = '" + no_skema + "' RETURNING no_skema;" result = connect(sql, 'PUT') return str(result)
def create_peserta(): nama = request.form['nama'] alamat = request.form['alamat'] email = request.form['email'] telp = request.form['telp'] sql = "INSERT INTO peserta(nama, alamat, email, telp, delete_status) VALUES('" + nama + "', '" + alamat + "', '" + email + "', '" + telp + "', '0') RETURNING no_peserta;" no_peserta = connect(sql, 'POST') return str(no_peserta)
def update_nilai(): id_hasil = request.form['id_hasil'] nilai_p = request.form['nilai_p'] nilai_i = request.form['nilai_i'] nilai_t = request.form['nilai_t'] sql = "UPDATE hasil SET nilai_p = '" + nilai_p + "', nilai_i = '" + nilai_i + "', nilai_t = '" + nilai_t + "', delete_status = '0' WHERE id_hasil = '" + id_hasil + "' RETURNING id_hasil;" result = connect(sql, 'PUT') return str(result)
def update_peserta(): no_peserta = request.form['no_peserta'] nama = request.form['nama'] alamat = request.form['alamat'] email = request.form['email'] telp = request.form['telp'] sql = "UPDATE peserta SET nama = '" + nama + "', alamat = '" + alamat + "', email = '" + email + "', telp = '" + telp + "', delete_status = 0 WHERE no_peserta = '" + no_peserta + "' RETURNING no_peserta;" no_peserta = connect(sql, 'PUT') return str(no_peserta)
def create_nilai(): no_peserta = request.form['no_peserta'] no_skema = request.form['no_skema'] nilai_p = request.form['nilai_p'] nilai_i = request.form['nilai_i'] nilai_t = request.form['nilai_t'] sql = "INSERT INTO hasil(no_peserta, no_skema, nilai_p, nilai_i, nilai_t, delete_status) VALUES('" + no_peserta + "','" + no_skema + "', '" + nilai_p + "', '" + nilai_i + "', '" + nilai_t + "', '0') RETURNING id_hasil;" hasil = connect(sql, 'POST') return str(hasil)
def get_peserta_by_id(): no_peserta = request.form['no_peserta'] sql = "SELECT nama, alamat, email, telp FROM peserta WHERE no_peserta = '" + no_peserta + "';" result = connect(sql, 'GET') return str(result)
def get_peserta(): sql = "SELECT * FROM peserta WHERE delete_status = 0;" result = connect(sql, 'GET') return str(result)
def get_nilai_by_id(): id_hasil = request.form['id_hasil'] sql = "SELECT no_peserta, no_skema, nilai_p, nilai_i, nilai_t FROM hasil WHERE id_hasil = '" + id_hasil + "';" result = connect(sql, 'GET') return str(result)
def get_nilai(): sql = "SELECT * FROM hasil WHERE delete_status = 0;" result = connect(sql, 'GET') return str(result)
def get_skema_by_id(): no_skema = request.form['no_skema'] sql = "SELECT nama_skema, ruang FROM skema WHERE no_skema = '" + no_skema + "';" result = connect(sql, 'GET') return str(result)