version alpha
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
@@ -160,39 +161,42 @@ class cl_Student_eval(models.Model):
|
||||
self.get_mirror_eval(self.a_evals)
|
||||
return self.mirrored
|
||||
|
||||
def get_eval_type(self):
|
||||
if isinstance(self.nEval_Type, int):
|
||||
return EVAL_TYPE[int(self.nEval_Type) - 1][1]
|
||||
return "Unknown"
|
||||
|
||||
def get_inter_complexity(self):
|
||||
if isinstance(self.nInter_Nature, int):
|
||||
return INTER_COMPLEXITY[int(self.nInter_Nature) - 1][1]
|
||||
return "Unknown"
|
||||
|
||||
def get_inter_priority(self):
|
||||
if isinstance(self.nInter_Priority, int):
|
||||
try:
|
||||
return INTER_PRIORITY[int(self.nInter_Priority) - 1][1]
|
||||
return "Unknown"
|
||||
except:
|
||||
return f"Unknown {self.nInter_Priority}"
|
||||
|
||||
def get_eval_mode(self):
|
||||
if isinstance(self.nEval_Mode, int):
|
||||
try:
|
||||
return EVAL_MODE[int(self.nEval_Mode) - 1][1]
|
||||
return "Unknown"
|
||||
except:
|
||||
return f"Unknown {self.nEval_Mode}"
|
||||
|
||||
def get_student_role(self):
|
||||
if isinstance(self.nStudent_Role, int):
|
||||
try:
|
||||
return STUDENT_ROLE[int(self.nStudent_Role) - 1][1]
|
||||
return "Unknown"
|
||||
except:
|
||||
return f"Unknown {self.nStudent_Role}"
|
||||
|
||||
def get_inter_nature(self):
|
||||
if isinstance(self.nInter_Nature,int):
|
||||
return INTER_NATURE[int(self.nInter_Nature)-1][1]
|
||||
return "Uncknow"
|
||||
|
||||
|
||||
try:
|
||||
return INTER_NATURE[int(self.nInter_Nature) - 1][1]
|
||||
except:
|
||||
return f"Unknown {self.nInter_Nature}"
|
||||
|
||||
def get_eval_type(self):
|
||||
try:
|
||||
return EVAL_TYPE[int(self.nEval_Type) - 1][1]
|
||||
except:
|
||||
return f"Unknown {self.nEval_Type}"
|
||||
|
||||
def get_inter_complexity(self):
|
||||
try:
|
||||
return INTER_COMPLEXITY[int(self.nInter_Nature) - 1][1]
|
||||
except:
|
||||
return f"Unknown {self.nInter_Nature}"
|
||||
|
||||
def __str__(self):
|
||||
try:
|
||||
@@ -227,12 +231,20 @@ def import_data_csv():
|
||||
value = line[key]
|
||||
if key == "dtDate":
|
||||
value = datetime.strptime(value, "%d.%m.%Y").date()
|
||||
elif key == "sStudent":
|
||||
#temp_obj = cl_Student_eval(
|
||||
elif key == "Student" and value is not "":
|
||||
print(f"user == pk{value}")
|
||||
temp_user = User.objects.get(pk=int(value))
|
||||
setattr(new_eval, "Student", temp_user)
|
||||
continue
|
||||
elif key == "ID":
|
||||
pass
|
||||
|
||||
setattr(new_eval, key,value)
|
||||
if key in ["nEval_Type","nInter_Priority","nInter_Nature","nInter_Complexity","nStudent_Role","nEval_Mode"]:
|
||||
print(f"key [{key}] => {value}")
|
||||
value = int(value) if value is not "" else ""
|
||||
|
||||
setattr(new_eval, key,value)
|
||||
print(f"try to save {line}")
|
||||
new_eval.save()
|
||||
print(f"Save new eval {new_eval.ID}")
|
||||
|
||||
|
Reference in New Issue
Block a user