276 lines
18 KiB
Python
276 lines
18 KiB
Python
import pymysql
|
|
|
|
conn = pymysql.connect(host='localhost', user='root', password='', database='tracerstudy_db', port=3306, charset='utf8mb4')
|
|
cur = conn.cursor()
|
|
|
|
# ===== PERTANYAAN =====
|
|
|
|
questions_data = [
|
|
# Section 1 - Identitas
|
|
{'kode': 'kdptimsmh', 'pertanyaan': 'Kode Perguruan Tinggi', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 1},
|
|
{'kode': 'kdpstmsnmh', 'pertanyaan': 'Kode Program Studi', 'tipe': 'pilihan', 'section': 'identitas', 'nomor_form': 2},
|
|
{'kode': 'nimhsmsnmh', 'pertanyaan': 'NIM / Nomor Mahasiswa', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 3},
|
|
{'kode': 'nmmhsmsnmh', 'pertanyaan': 'Nama Lengkap', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 4},
|
|
{'kode': 'telepon', 'pertanyaan': 'Nomor Telepon/HP (Whatsapp)', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 5},
|
|
{'kode': 'email', 'pertanyaan': 'Alamat Email', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 6},
|
|
{'kode': 'tahun_lulus', 'pertanyaan': 'Tahun Lulus', 'tipe': 'dropdown', 'section': 'identitas', 'nomor_form': 7},
|
|
{'kode': 'nik', 'pertanyaan': 'NIK / Nomor Induk Kependudukan', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 8},
|
|
{'kode': 'npwp', 'pertanyaan': 'NPWP', 'tipe': 'teks', 'section': 'identitas', 'nomor_form': 9},
|
|
|
|
# Section 2 - Kuesioner Utama
|
|
{'kode': 'F8', 'pertanyaan': 'Jelaskan status Anda saat ini?', 'tipe': 'dropdown', 'section': 'kuesioner_utama', 'nomor_form': 1},
|
|
{'kode': 'F502', 'pertanyaan': 'Dalam berapa bulan Anda mendapatkan pekerjaan pertama?', 'tipe': 'dropdown', 'section': 'kuesioner_utama', 'nomor_form': 2},
|
|
{'kode': 'F505', 'pertanyaan': 'Berapa rata-rata pendapatan Anda per bulan?', 'tipe': 'pilihan', 'section': 'kuesioner_utama', 'nomor_form': 4},
|
|
{'kode': 'F5a1', 'pertanyaan': 'Provinsi tempat bekerja', 'tipe': 'dropdown', 'section': 'kuesioner_utama', 'nomor_form': 5},
|
|
{'kode': 'F5a2', 'pertanyaan': 'Kabupaten/Kota tempat bekerja', 'tipe': 'dropdown', 'section': 'kuesioner_utama', 'nomor_form': 6},
|
|
{'kode': 'F1101', 'pertanyaan': 'Jenis perusahaan/instansi/institusi tempat bekerja', 'tipe': 'pilihan', 'section': 'kuesioner_utama', 'nomor_form': 7},
|
|
{'kode': 'F5b', 'pertanyaan': 'Nama perusahaan/kantor', 'tipe': 'teks', 'section': 'kuesioner_utama', 'nomor_form': 8},
|
|
{'kode': 'F5c', 'pertanyaan': 'Posisi/Jabatan (Wiraswasta)', 'tipe': 'pilihan', 'section': 'kuesioner_utama', 'nomor_form': 9},
|
|
{'kode': 'F5d', 'pertanyaan': 'Tingkatan tempat kerja', 'tipe': 'pilihan', 'section': 'kuesioner_utama', 'nomor_form': 10},
|
|
|
|
# Studi Lanjut
|
|
{'kode': 'F18a', 'pertanyaan': 'Sumber biaya Studi Lanjut', 'tipe': 'dropdown', 'section': 'studi_lanjut', 'nomor_form': 11},
|
|
{'kode': 'F18b', 'pertanyaan': 'Nama PT Studi Lanjut', 'tipe': 'teks', 'section': 'studi_lanjut', 'nomor_form': 12},
|
|
{'kode': 'F18c', 'pertanyaan': 'Program Studi Studi Lanjut', 'tipe': 'teks', 'section': 'studi_lanjut', 'nomor_form': 13},
|
|
{'kode': 'F18d', 'pertanyaan': 'Tanggal Masuk Studi Lanjut', 'tipe': 'date', 'section': 'studi_lanjut', 'nomor_form': 14},
|
|
|
|
# Pembiayaan & Kesesuaian
|
|
{'kode': 'F1201', 'pertanyaan': 'Sumber pembiayaan kuliah', 'tipe': 'pilihan', 'section': 'kesesuaian', 'nomor_form': 15},
|
|
{'kode': 'F14', 'pertanyaan': 'Seberapa erat hubungan bidang studi dengan pekerjaan', 'tipe': 'pilihan', 'section': 'kesesuaian', 'nomor_form': 16},
|
|
{'kode': 'F15', 'pertanyaan': 'Tingkat pendidikan yang tepat untuk pekerjaan saat ini', 'tipe': 'pilihan', 'section': 'kesesuaian', 'nomor_form': 17},
|
|
|
|
# Kompetensi
|
|
{'kode': 'F1761', 'pertanyaan': 'Kompetensi ETIKA saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 18},
|
|
{'kode': 'F1762', 'pertanyaan': 'Kompetensi ETIKA saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 19},
|
|
{'kode': 'F1763', 'pertanyaan': 'Kompetensi KEAHLIAN BIDANG ILMU saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 20},
|
|
{'kode': 'F1764', 'pertanyaan': 'Kompetensi KEAHLIAN BIDANG ILMU saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 21},
|
|
{'kode': 'F1765', 'pertanyaan': 'Kompetensi BAHASA INGGRIS saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 22},
|
|
{'kode': 'F1766', 'pertanyaan': 'Kompetensi BAHASA INGGRIS saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 23},
|
|
{'kode': 'F1767', 'pertanyaan': 'Kompetensi TEKNOLOGI INFORMASI saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 24},
|
|
{'kode': 'F1768', 'pertanyaan': 'Kompetensi TEKNOLOGI INFORMASI saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 25},
|
|
{'kode': 'F1769', 'pertanyaan': 'Kompetensi KOMUNIKASI saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 26},
|
|
{'kode': 'F1770', 'pertanyaan': 'Kompetensi KOMUNIKASI saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 27},
|
|
{'kode': 'F1771', 'pertanyaan': 'Kompetensi KERJA SAMA TIM saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 28},
|
|
{'kode': 'F1772', 'pertanyaan': 'Kompetensi KERJA SAMA TIM saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 29},
|
|
{'kode': 'F1773', 'pertanyaan': 'Kompetensi PENGEMBANGAN DIRI saat LULUS', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 30},
|
|
{'kode': 'F1774', 'pertanyaan': 'Kompetensi PENGEMBANGAN DIRI saat INI', 'tipe': 'skala', 'section': 'kompetensi', 'nomor_form': 31},
|
|
|
|
# Metode Pembelajaran
|
|
{'kode': 'F21', 'pertanyaan': 'Perkuliahan', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 32},
|
|
{'kode': 'F22', 'pertanyaan': 'Demonstrasi', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 33},
|
|
{'kode': 'F23', 'pertanyaan': 'Partisipasi dalam proyek riset', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 34},
|
|
{'kode': 'F24', 'pertanyaan': 'Magang', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 35},
|
|
{'kode': 'F25', 'pertanyaan': 'Praktikum', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 36},
|
|
{'kode': 'F26', 'pertanyaan': 'Kerja Lapangan', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 37},
|
|
{'kode': 'F27', 'pertanyaan': 'Diskusi', 'tipe': 'skala', 'section': 'metode_pembelajaran', 'nomor_form': 38},
|
|
|
|
# Waktu Cari Kerja
|
|
{'kode': 'F301', 'pertanyaan': 'Kapan mulai mencari pekerjaan?', 'tipe': 'pilihan', 'section': 'waktu_cari_kerja', 'nomor_form': 39},
|
|
{'kode': 'F302', 'pertanyaan': 'Berapa bulan sebelum lulus mencari kerja?', 'tipe': 'dropdown', 'section': 'waktu_cari_kerja', 'nomor_form': 40},
|
|
{'kode': 'F303', 'pertanyaan': 'Berapa bulan setelah wisuda mencari kerja?', 'tipe': 'dropdown', 'section': 'waktu_cari_kerja', 'nomor_form': 41},
|
|
|
|
# Cara Cari Kerja
|
|
{'kode': 'F401', 'pertanyaan': 'Melamar melalui iklan di koran/majalah/brosur?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 42},
|
|
{'kode': 'F402', 'pertanyaan': 'Melamar ke perusahaan tanpa mengetahui lowongan?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 43},
|
|
{'kode': 'F403', 'pertanyaan': 'Pergi ke bursa/pameran kerja?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 44},
|
|
{'kode': 'F404', 'pertanyaan': 'Mencari lewat internet/iklan online/milis?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 45},
|
|
{'kode': 'F405', 'pertanyaan': 'Dihubungi perusahaan?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 46},
|
|
{'kode': 'F406', 'pertanyaan': 'Menghubungi Kemenakertrans?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 47},
|
|
{'kode': 'F407', 'pertanyaan': 'Menghubungi agen tenaga kerja komersial/swasta?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 48},
|
|
{'kode': 'F408', 'pertanyaan': 'Informasi dari pusat/kantor pengembangan karir?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 49},
|
|
{'kode': 'F409', 'pertanyaan': 'Menghubungi kantor kemahasiswaan?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 50},
|
|
{'kode': 'F410', 'pertanyaan': 'Membangun jejaring (network)?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 51},
|
|
{'kode': 'F411', 'pertanyaan': 'Melaui relasi (dosen, orang tua, teman)?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 52},
|
|
{'kode': 'F412', 'pertanyaan': 'Membangun bisnis sendiri?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 53},
|
|
{'kode': 'F413', 'pertanyaan': 'Melalui penempatan kerja/magang?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 54},
|
|
{'kode': 'F414', 'pertanyaan': 'Bekerja di tempat yang sama dengan waktu kuliah?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 55},
|
|
{'kode': 'F415', 'pertanyaan': 'Cara lain?', 'tipe': 'ya_tidak', 'section': 'cara_cari_kerja', 'nomor_form': 56},
|
|
|
|
# Jumlah Lamaran
|
|
{'kode': 'F6', 'pertanyaan': 'Jumlah perusahaan yang dilamar', 'tipe': 'dropdown', 'section': 'lamaran', 'nomor_form': 57},
|
|
{'kode': 'F7', 'pertanyaan': 'Jumlah perusahaan yang merespons', 'tipe': 'dropdown', 'section': 'lamaran', 'nomor_form': 58},
|
|
{'kode': 'F7a', 'pertanyaan': 'Jumlah perusahaan yang mengundang wawancara', 'tipe': 'dropdown', 'section': 'lamaran', 'nomor_form': 59},
|
|
|
|
# Aktif Cari Kerja
|
|
{'kode': 'F1001', 'pertanyaan': 'Aktif mencari pekerjaan dalam 4 minggu terakhir?', 'tipe': 'pilihan', 'section': 'aktif_cari_kerja', 'nomor_form': 60},
|
|
|
|
# Kesesuaian Pekerjaan
|
|
{'kode': 'F1601', 'pertanyaan': 'Pekerjaan sesuai dengan pendidikan?', 'tipe': 'pilihan', 'section': 'kesesuaian_pekerjaan', 'nomor_form': 61},
|
|
{'kode': 'F1602', 'pertanyaan': 'Alasan belum dapat pekerjaan sesuai?', 'tipe': 'pilihan', 'section': 'kesesuaian_pekerjaan', 'nomor_form': 62},
|
|
{'kode': 'F1603', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (1)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 63},
|
|
{'kode': 'F1604', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (2)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 64},
|
|
{'kode': 'F1605', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (3)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 65},
|
|
{'kode': 'F1606', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (4)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 66},
|
|
{'kode': 'F1607', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (5)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 67},
|
|
{'kode': 'F1608', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (6)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 68},
|
|
{'kode': 'F1609', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (7)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 69},
|
|
{'kode': 'F1610', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (8)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 70},
|
|
{'kode': 'F1611', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (9)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 71},
|
|
{'kode': 'F1612', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (10)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 72},
|
|
{'kode': 'F1613', 'pertanyaan': 'Alasan mengambil pekerjaan tidak sesuai (11)?', 'tipe': 'ya_tidak', 'section': 'alasan_tidak_sesuai', 'nomor_form': 73},
|
|
{'kode': 'F1614', 'pertanyaan': 'Alasan lainnya', 'tipe': 'teks', 'section': 'alasan_tidak_sesuai', 'nomor_form': 74},
|
|
]
|
|
|
|
# Insert questions
|
|
for q in questions_data:
|
|
cur.execute('''
|
|
INSERT INTO questions (kode, pertanyaan, tipe, section, nomor_form)
|
|
VALUES (%s, %s, %s, %s, %s)
|
|
ON DUPLICATE KEY UPDATE pertanyaan = VALUES(pertanyaan)
|
|
''', (q['kode'], q['pertanyaan'], q['tipe'], q['section'], q['nomor_form']))
|
|
|
|
conn.commit()
|
|
print(f'Successfully inserted {len(questions_data)} questions')
|
|
|
|
# ===== JAWABAN OPTIONS =====
|
|
answer_options = [
|
|
# F8 - Status saat ini
|
|
('F8', '1', 'Bekerja (full time/part time)', 1),
|
|
('F8', '2', 'Belum memungkinkan bekerja', 2),
|
|
('F8', '3', 'Wiraswasta', 3),
|
|
('F8', '4', 'Melanjutkan Pendidikan', 4),
|
|
('F8', '5', 'Tidak kerja tetapi sedang mencari kerja', 5),
|
|
|
|
# F505 - Pendapatan
|
|
('F505', '1000000', 'Rp 1.000.000', 1),
|
|
('F505', '1500000', 'Rp 1.500.000', 2),
|
|
('F505', '2000000', 'Rp 2.000.000', 3),
|
|
('F505', '2500000', 'Rp 2.500.000', 4),
|
|
('F505', '3000000', 'Rp 3.000.000', 5),
|
|
('F505', '3500000', 'Rp 3.500.000', 6),
|
|
('F505', '4000000', 'Rp 4.000.000', 7),
|
|
('F505', '4500000', 'Rp 4.500.000', 8),
|
|
('F505', '5000000', 'Rp 5.000.000', 9),
|
|
('F505', '6000000', 'Rp 6.000.000', 10),
|
|
('F505', '7000000', 'Rp 7.000.000', 11),
|
|
('F505', '8000000', '>Rp 8.000.000', 12),
|
|
|
|
# F1101 - Jenis perusahaan
|
|
('F1101', '1', 'Instansi pemerintah', 1),
|
|
('F1101', '2', 'Organisasi non-profit/Lembaga Swadaya Masyarakat', 2),
|
|
('F1101', '3', 'Perusahaan swasta', 3),
|
|
('F1101', '4', 'Wiraswasta/perusahaan sendiri', 4),
|
|
('F1101', '5', 'Lainnya', 5),
|
|
('F1101', '6', 'BUMN/BUMD', 6),
|
|
('F1101', '7', 'Institusi/Organisasi Multilateral', 7),
|
|
|
|
# F5d - Tingkatan tempat kerja
|
|
('F5d', '1', 'Lokal/wilayah/wiraswasta tidak berbadan hukum', 1),
|
|
('F5d', '2', 'Nasional/wiraswasta berbadan hukum', 2),
|
|
('F5d', '3', 'Multinasional/Internasional', 3),
|
|
|
|
# F5c - Jabatan wiraswasta
|
|
('F5c', '1', 'Founder', 1),
|
|
('F5c', '2', 'Co-Founder', 2),
|
|
('F5c', '3', 'Staff', 3),
|
|
('F5c', '4', 'Freelance/Kerja Lepas', 4),
|
|
|
|
# F18a - Sumber biaya studi lanjut
|
|
('F18a', '1', 'Biaya Sendiri', 1),
|
|
('F18a', '2', 'Beasiswa', 2),
|
|
|
|
# F1201 - Sumber biaya kuliah
|
|
('F1201', '1', 'Biaya Sendiri/Keluarga', 1),
|
|
('F1201', '2', 'Beasiswa ADIK', 2),
|
|
('F1201', '3', 'Beasiswa BIDIKMISI', 3),
|
|
('F1201', '4', 'Beasiswa PPA', 4),
|
|
('F1201', '5', 'Beasiswa AFIRMASI', 5),
|
|
('F1201', '6', 'Beasiswa Perusahaan/Swasta', 6),
|
|
('F1201', '7', 'Lainnya', 7),
|
|
|
|
# F14 - Keeratan bidang studi
|
|
('F14', '1', 'Sangat Erat', 1),
|
|
('F14', '2', 'Erat', 2),
|
|
('F14', '3', 'Cukup Erat', 3),
|
|
('F14', '4', 'Kurang Erat', 4),
|
|
('F14', '5', 'Tidak sama sekali', 5),
|
|
|
|
# F15 - Tingkat pendidikan tepat
|
|
('F15', '1', 'Setingkat lebih tinggi', 1),
|
|
('F15', '2', 'Tingkat yang sama', 2),
|
|
('F15', '3', 'Setingkat lebih rendah', 3),
|
|
('F15', '4', 'Tidak perlu pendidikan tinggi', 4),
|
|
|
|
# F301 - Mulai cari kerja
|
|
('F301', '1', 'Saya mencari kerja sebelum lulus', 1),
|
|
('F301', '2', 'Saya mencari kerja sesudah wisuda', 2),
|
|
('F301', '3', 'Saya tidak mencari kerja', 3),
|
|
|
|
# F1001 - Aktif cari kerja
|
|
('F1001', '1', 'Tidak', 1),
|
|
('F1001', '2', 'Tidak, tapi saya sedang menunggu hasil lamaran kerja', 2),
|
|
('F1001', '3', 'Ya, saya akan mulai bekerja dalam 2 minggu ke depan', 3),
|
|
('F1001', '4', 'Ya, tapi saya belum pasti akan bekerja dalam 2 minggu ke depan', 4),
|
|
('F1001', '5', 'Lainnya', 5),
|
|
|
|
# F1601 - Kesesuaian pekerjaan
|
|
('F1601', '0', 'Tidak sesuai', 1),
|
|
('F1601', '1', 'Pekerjaan saya sekarang sudah sesuai dengan pendidikan saya', 2),
|
|
|
|
# F1602 - Alasan belum sesuai
|
|
('F1602', '0', 'Pekerjaan saya sudah sesuai', 1),
|
|
('F1602', '1', 'Saya belum mendapatkan pekerjaan yang lebih sesuai', 2),
|
|
]
|
|
|
|
# Insert answer options with question_id lookup
|
|
for kode, kode_jawaban, teks, urutan in answer_options:
|
|
# Get question_id from questions table
|
|
cur.execute('SELECT id FROM questions WHERE kode = %s', (kode,))
|
|
result = cur.fetchone()
|
|
if result:
|
|
question_id = result[0]
|
|
cur.execute('''
|
|
INSERT INTO answer_options (question_id, kode, teks, urutan)
|
|
VALUES (%s, %s, %s, %s)
|
|
ON DUPLICATE KEY UPDATE teks = VALUES(teks)
|
|
''', (question_id, kode_jawaban, teks, urutan))
|
|
|
|
conn.commit()
|
|
print(f'Successfully inserted answer options')
|
|
|
|
# Skala 1-5 (untuk kompetensi dan metode pembelajaran)
|
|
skala_labels = ['Sangat Rendah', 'Rendah', 'Netral', 'Tinggi', 'Sangat Tinggi']
|
|
for kode in ['F1761', 'F1762', 'F1763', 'F1764', 'F1765', 'F1766', 'F1767', 'F1768', 'F1769', 'F1770', 'F1771', 'F1772', 'F1773', 'F1774']:
|
|
cur.execute('SELECT id FROM questions WHERE kode = %s', (kode,))
|
|
result = cur.fetchone()
|
|
if result:
|
|
question_id = result[0]
|
|
for i, label in enumerate(skala_labels, 1):
|
|
cur.execute('''
|
|
INSERT INTO answer_options (question_id, kode, teks, urutan)
|
|
VALUES (%s, %s, %s, %s)
|
|
ON DUPLICATE KEY UPDATE teks = VALUES(teks)
|
|
''', (question_id, str(i), label, i))
|
|
|
|
# Metode pembelajaran - scale berbeda
|
|
metode_labels = ['Sangat Besar', 'Besar', 'Cukup Besar', 'Kurang', 'Tidak Sama Sekali']
|
|
for kode in ['F21', 'F22', 'F23', 'F24', 'F25', 'F26', 'F27']:
|
|
cur.execute('SELECT id FROM questions WHERE kode = %s', (kode,))
|
|
result = cur.fetchone()
|
|
if result:
|
|
question_id = result[0]
|
|
for i, label in enumerate(metode_labels, 1):
|
|
cur.execute('''
|
|
INSERT INTO answer_options (question_id, kode, teks, urutan)
|
|
VALUES (%s, %s, %s, %s)
|
|
ON DUPLICATE KEY UPDATE teks = VALUES(teks)
|
|
''', (question_id, str(i), label, i))
|
|
|
|
# Ya/Tidak untuk cara cari kerja
|
|
for kode in ['F401', 'F402', 'F403', 'F404', 'F405', 'F406', 'F407', 'F408', 'F409', 'F410', 'F411', 'F412', 'F413', 'F414', 'F415']:
|
|
cur.execute('SELECT id FROM questions WHERE kode = %s', (kode,))
|
|
result = cur.fetchone()
|
|
if result:
|
|
question_id = result[0]
|
|
for i, label in enumerate(['Tidak', 'Ya'], 0):
|
|
cur.execute('''
|
|
INSERT INTO answer_options (question_id, kode, teks, urutan)
|
|
VALUES (%s, %s, %s, %s)
|
|
ON DUPLICATE KEY UPDATE teks = VALUES(teks)
|
|
''', (question_id, str(i), label, i))
|
|
|
|
conn.commit()
|
|
print('All answer options inserted successfully!')
|
|
|
|
conn.close()
|