use of com.remswork.project.alice.service.impl.FormulaServiceImpl in project classify-system by anverliedoit.
the class FormulaHelper method getFormula.
public Formula getFormula(String key) throws GradingFactorException {
SharedPreferences sharedPreferences = context.getSharedPreferences("aliceUserDetail", Context.MODE_PRIVATE);
id = sharedPreferences.getLong(key, 0);
return new FormulaServiceImpl().getFormulaById(id);
}
use of com.remswork.project.alice.service.impl.FormulaServiceImpl in project classify-system by anverliedoit.
the class CriteriaFinaltermInputActivity method onClick.
@Override
public void onClick(View v) {
Formula _formula = new Formula();
_formula.setActivityPercentage(percent[0]);
_formula.setAssignmentPercentage(percent[1]);
_formula.setAttendancePercentage(percent[2]);
_formula.setExamPercentage(percent[3]);
_formula.setProjectPercentage(percent[4]);
_formula.setQuizPercentage(percent[5]);
try {
if (Integer.parseInt(txtTotalPercent.getText().toString().split("%")[0]) != 100) {
cardViewFailed.setVisibility(View.VISIBLE);
return;
}
Log.i("LAPTOP", teacher.getId() + "");
Log.i("LAPTOP", subject.getId() + "");
Log.i("LAPTOP", isExist + "");
if (!isExist)
_formula = new FormulaServiceImpl().addFormula(_formula, subject.getId(), teacher.getId(), 2);
else
_formula = new FormulaServiceImpl().updateFormulaById(formula.getId(), _formula, 0, 0, 0);
} catch (GradingFactorException e) {
e.printStackTrace();
}
if (_formula != null) {
getIntent().setClass(this, SubjectViewActivity.class);
startActivity(getIntent());
finish();
} else
Toast.makeText(CriteriaFinaltermInputActivity.this, "Please try again", Toast.LENGTH_SHORT).show();
}
use of com.remswork.project.alice.service.impl.FormulaServiceImpl in project classify-system by anverliedoit.
the class ActivityGradeActivity method load.
public void load() {
try {
final FormulaService formulaService = new FormulaServiceImpl();
final GradeService gradeService = new GradeServiceImpl();
final long termId = getIntent().getExtras().getLong("termId");
final long classId = getIntent().getExtras().getLong("classId");
final Class _class = classService.getClassById(classId);
final long subjectId = _class.getSubject() != null ? _class.getSubject().getId() : 0;
final long teacherId = _class.getTeacher() != null ? _class.getTeacher().getId() : 0;
final Formula formula = formulaService.getFormulaBySubjectAndTeacherId(subjectId, teacherId, termId);
Log.i("SOMETHINGGG", "CLASSID" + classId + " FORMULAID" + formula.getId());
for (final Student student : classService.getStudentList(classId)) {
final Student cStudent = student;
Log.i("SOMETHINGGG", "Student" + student.getId());
Log.i("FORMULA", formula.getId() + "");
new Thread(new Runnable() {
@Override
public void run() {
try {
long studentId = cStudent.getId();
List<Grade> temp = gradeService.getGradeListByClass(classId, studentId, termId);
Grade grade = temp.size() > 0 ? temp.get(0) : new Grade();
Log.i("GRADE", grade.getId() + "");
double totalScore = ((double) formula.getActivityPercentage() / 100) * grade.getActivityScore();
grade.setTotalScore(totalScore);
grade.setStudent(student);
Log.i("SOMETHINGGG", "totalScore" + formula.getActivityPercentage());
gradeList.add(grade);
notifyChange();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.remswork.project.alice.service.impl.FormulaServiceImpl in project classify-system by anverliedoit.
the class ActivityGradeAssignment method load.
public void load() {
try {
final FormulaService formulaService = new FormulaServiceImpl();
final GradeService gradeService = new GradeServiceImpl();
final long termId = getIntent().getExtras().getLong("termId");
final long classId = getIntent().getExtras().getLong("classId");
final Class _class = classService.getClassById(classId);
final long subjectId = _class.getSubject() != null ? _class.getSubject().getId() : 0;
final long teacherId = _class.getTeacher() != null ? _class.getTeacher().getId() : 0;
final Formula formula = formulaService.getFormulaBySubjectAndTeacherId(subjectId, teacherId, termId);
Log.i("SOMETHINGGG", "CLASSID" + classId + " FORMULAID" + formula.getId());
for (final Student student : classService.getStudentList(classId)) {
final Student cStudent = student;
Log.i("SOMETHINGGG", "Student" + student.getId());
Log.i("FORMULA", formula.getId() + "");
new Thread(new Runnable() {
@Override
public void run() {
try {
long studentId = cStudent.getId();
List<Grade> temp = gradeService.getGradeListByClass(classId, studentId, termId);
Grade grade = temp.size() > 0 ? temp.get(0) : new Grade();
Log.i("GRADE", grade.getId() + "");
double totalScore = ((double) formula.getAssignmentPercentage() / 100) * grade.getAssignmentScore();
grade.setTotalScore(totalScore);
grade.setStudent(student);
Log.i("SOMETHINGGG", "totalScore" + formula.getAssignmentPercentage());
gradeList.add(grade);
notifyChange();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of com.remswork.project.alice.service.impl.FormulaServiceImpl in project classify-system by anverliedoit.
the class ActivityGradeQuiz method load.
public void load() {
try {
final FormulaService formulaService = new FormulaServiceImpl();
final GradeService gradeService = new GradeServiceImpl();
final long termId = getIntent().getExtras().getLong("termId");
final long classId = getIntent().getExtras().getLong("classId");
final Class _class = classService.getClassById(classId);
final long subjectId = _class.getSubject() != null ? _class.getSubject().getId() : 0;
final long teacherId = _class.getTeacher() != null ? _class.getTeacher().getId() : 0;
final Formula formula = formulaService.getFormulaBySubjectAndTeacherId(subjectId, teacherId, termId);
Log.i("SOMETHINGGG", "CLASSID" + classId + " FORMULAID" + formula.getId());
for (final Student student : classService.getStudentList(classId)) {
final Student cStudent = student;
Log.i("SOMETHINGGG", "Student" + student.getId());
Log.i("FORMULA", formula.getId() + "");
new Thread(new Runnable() {
@Override
public void run() {
try {
long studentId = cStudent.getId();
List<Grade> temp = gradeService.getGradeListByClass(classId, studentId, termId);
Grade grade = temp.size() > 0 ? temp.get(0) : new Grade();
Log.i("GRADE", grade.getId() + "");
double totalScore = ((double) formula.getQuizPercentage() / 100) * grade.getQuizScore();
grade.setTotalScore(totalScore);
grade.setStudent(student);
Log.i("SOMETHINGGG", "totalScore" + formula.getQuizPercentage());
gradeList.add(grade);
notifyChange();
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
}
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations