Compare commits

..

2 Commits

Author SHA1 Message Date
Your Name
b919c4b2d5 update database strukture 2024-06-11 22:29:55 +03:00
Your Name
78cc72fafa fix adding to select 2024-06-11 21:55:16 +03:00
4 changed files with 66 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
import datetime
db = SQLAlchemy()
@@ -11,3 +11,38 @@ class CommissionPersons(db.Model):
isrecenzent = db.Column(db.Boolean, nullable=False, default=False)
issecretar = db.Column(db.Boolean, nullable=False, default=False)
class CommissionSostav(db.Model):
id = db.Column(db.Integer, primary_key=True)
predsedatel = db.Column(db.String(100), nullable=False)
uchastnik1=db.Column(db.String(100), nullable=False)
uchastnik2=db.Column(db.String(100), nullable=False)
uchastnik3=db.Column(db.String(100), nullable=False)
uchastnik4=db.Column(db.String(100), nullable=False)
secretar=db.Column(db.String(100), nullable=False)
class Rukovoditeli(db.Model):
id = db.Column(db.Integer, primary_key=True)
fio = db.Column(db.String(80), nullable=False)
canMagistr = db.Column(db.Boolean, nullable=False, default=False)
stepen = db.Column(db.String(80), nullable=False)
dolognost = db.Column(db.String(80), nullable=False)
class Studentus(db.Model):
id = db.Column(db.Integer, primary_key=True)
fio = db.Column(db.String(80), nullable=False)
vkrTheme = db.Column(db.String(80), nullable=False)
rucovoditel_id = db.Column(db.Integer, db.ForeignKey('rukovoditeli.id'), nullable=False)
konsultant_id = db.Column(db.Integer, db.ForeignKey('rukovoditeli.id'), nullable=False)
rucovoditel = db.relationship('Rukovoditeli', foreign_keys=[rucovoditel_id],
backref=db.backref('students_as_rucovoditel', lazy=True))
konsultant = db.relationship('Rukovoditeli', foreign_keys=[konsultant_id],
backref=db.backref('students_as_konsultant', lazy=True))
class CommissionZasedanie(db.Model):
id = db.Column(db.Integer, primary_key=True)
data = db.Column(db.DateTime, nullable=False)
commission_sostav_id = db.Column(db.Integer, db.ForeignKey('commission_sostav.id'), nullable=False)
commission_sostav = db.relationship('CommissionSostav', uselist=False, backref=db.backref('zasedanie', lazy=True))
students = db.relationship('Studentus', backref=db.backref('zasedanie', lazy=True))

View File

@@ -22,38 +22,44 @@ $(document).ready(function () {
} else {
secretars.push(element.fio)
}
if (element.predsed == 1) {
preds.push(element.fio)
}
});
console.log(preds)
console.log(secretars)
console.log(alluchs)
for (i = 0; i < preds.length; i++) {
let newOption = new Option(preds[i], preds[i])
preds.forEach( function (item) {
let newOption = new Option(item, item)
predsel.appendChild(newOption)
}
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch1.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch2.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch3.appendChild(newOption);
})
alluchs.forEach(function (item) {
let newOption = new Option(item, item)
uch4.appendChild(newOption);
})
secretars.forEach(function (item) {
let newOption = new Option(item, item)
secretar.appendChild(newOption)
})
alltagych = Array.from( $('select[id^="uchgak"]'))
alltagych.forEach(function (alltagychItem) {
alluchs.forEach(function (item) {
const option = document.createElement('option');
option.value = item;
option.textContent = item;
alltagychItem.appendChild(option)
})
})
});
});

View File

@@ -27,6 +27,7 @@ btnadd.onclick = function (){
}
)
document.getElementById("fio").value = "";
document.getElementById("predsedatel").checked = false;
document.getElementById("recentzent").checked = false;

View File

@@ -19,14 +19,14 @@
</div>
<div class="row">
<label>Участник</label>
<label>Участник1</label>
<select id="uchgak1">
<option>--Выбери--</option>
</select>
</div>
<div class="row">
<label>Участник</label>
<label>Участник2</label>
<select id="uchgak2">
<option>--Выбери--</option>
</select>
@@ -34,14 +34,14 @@
<div class="row">
<label>Участник</label>
<label>Участник3</label>
<select id="uchgak3">
<option>--Выбери--</option>
</select>
</div>
<div class="row">
<label>Участник</label>
<label>Участник4</label>
<select id="uchgak4">
<option>--Выбери--</option>
</select>