Search in sources :

Example 6 with FormulaServiceImpl

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);
}
Also used : SharedPreferences(android.content.SharedPreferences) FormulaServiceImpl(com.remswork.project.alice.service.impl.FormulaServiceImpl)

Example 7 with FormulaServiceImpl

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();
}
Also used : Formula(com.remswork.project.alice.model.Formula) GradingFactorException(com.remswork.project.alice.exception.GradingFactorException) FormulaServiceImpl(com.remswork.project.alice.service.impl.FormulaServiceImpl)

Example 8 with FormulaServiceImpl

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();
    }
}
Also used : GradeService(com.remswork.project.alice.service.GradeService) FormulaService(com.remswork.project.alice.service.FormulaService) Grade(com.remswork.project.alice.model.Grade) Student(com.remswork.project.alice.model.Student) Formula(com.remswork.project.alice.model.Formula) GradeServiceImpl(com.remswork.project.alice.service.impl.GradeServiceImpl) Class(com.remswork.project.alice.model.Class) FormulaServiceImpl(com.remswork.project.alice.service.impl.FormulaServiceImpl)

Example 9 with FormulaServiceImpl

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();
    }
}
Also used : GradeService(com.remswork.project.alice.service.GradeService) FormulaService(com.remswork.project.alice.service.FormulaService) Grade(com.remswork.project.alice.model.Grade) Student(com.remswork.project.alice.model.Student) Formula(com.remswork.project.alice.model.Formula) GradeServiceImpl(com.remswork.project.alice.service.impl.GradeServiceImpl) Class(com.remswork.project.alice.model.Class) FormulaServiceImpl(com.remswork.project.alice.service.impl.FormulaServiceImpl)

Example 10 with FormulaServiceImpl

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();
    }
}
Also used : GradeService(com.remswork.project.alice.service.GradeService) FormulaService(com.remswork.project.alice.service.FormulaService) Grade(com.remswork.project.alice.model.Grade) Student(com.remswork.project.alice.model.Student) Formula(com.remswork.project.alice.model.Formula) GradeServiceImpl(com.remswork.project.alice.service.impl.GradeServiceImpl) Class(com.remswork.project.alice.model.Class) FormulaServiceImpl(com.remswork.project.alice.service.impl.FormulaServiceImpl)

Aggregations

FormulaServiceImpl (com.remswork.project.alice.service.impl.FormulaServiceImpl)11 Formula (com.remswork.project.alice.model.Formula)10 Class (com.remswork.project.alice.model.Class)6 Grade (com.remswork.project.alice.model.Grade)6 Student (com.remswork.project.alice.model.Student)6 FormulaService (com.remswork.project.alice.service.FormulaService)6 GradeService (com.remswork.project.alice.service.GradeService)6 GradeServiceImpl (com.remswork.project.alice.service.impl.GradeServiceImpl)6 GradingFactorException (com.remswork.project.alice.exception.GradingFactorException)4 View (android.view.View)2 ArrayAdapter (android.widget.ArrayAdapter)2 Button (android.widget.Button)2 CompoundButton (android.widget.CompoundButton)2 SeekBar (android.widget.SeekBar)2 TextView (android.widget.TextView)2 TeacherHelper (com.lieverandiver.thesisproject.helper.TeacherHelper)2 Subject (com.remswork.project.alice.model.Subject)2 Teacher (com.remswork.project.alice.model.Teacher)2 SubjectServiceImpl (com.remswork.project.alice.service.impl.SubjectServiceImpl)2 Intent (android.content.Intent)1