public JsonResult AverageByAssessment(int assessment, int percentage) { bands start = new bands(); double?totalMarks = db.AspNetAssessments.Where(x => x.Id == assessment).Select(x => x.TotalMarks).FirstOrDefault(); int passignmarks = Convert.ToInt32(totalMarks * percentage / 100); start.startValue = 0; start.endValue = passignmarks; start.color = "#cc4748"; bands middle = new bands(); middle.startValue = start.endValue; middle.endValue = Convert.ToInt32(totalMarks * 80 / 100); middle.color = "#fdd400"; bands end = new bands(); end.startValue = middle.endValue; end.endValue = Convert.ToInt32(totalMarks); end.color = "#84b761"; average averageAssessment = new average(); averageAssessment.band = new bands[3]; averageAssessment.band[0] = start; averageAssessment.band[1] = middle; averageAssessment.band[2] = end; List <int?> stu_assessment = (from student_assessment in db.AspNetStudent_Assessment where student_assessment.AssessmentID == assessment select student_assessment.MarksGot).ToList(); double?count = 0; int n = 0; foreach (var item in stu_assessment) { count = count + item; n++; } averageAssessment.average_marks = Convert.ToInt32(count / n); return(Json(averageAssessment, JsonRequestBehavior.AllowGet)); }
// Use this for initialization void Start() { createTime = new Queue <float> [5]; createInfo = new Queue <int> [5]; timer = new float[5]; isCreate = new bool[5]; fristIn = new bool[5]; for (int i = 0; i < 5; i++) { isCreate[i] = false; fristIn[i] = true; createTime[i] = new Queue <float>(); createInfo[i] = new Queue <int>(); } isPlay = false; startLoad = false; clock = 0; dist = Vector3.Distance(start.position, end.position); audios = GetComponent <AudioSource>(); path = Application.dataPath + "/Resources/superwings.json"; StreamReader sr = new StreamReader(path); string json = sr.ReadToEnd(); bands band = new bands(); band.ChangeBPM = new List <ChangeBPM>(); band.Track = new List <Track>(); band = JsonUtility.FromJson <bands>(json); var timePerTick = band.ChangeBPM[0].TimePerTick; for (int i = 1; i <= 5; i++) { for (int j = 0; j < band.Track[i].NoteData.Capacity; j++) { createTime[i - 1].Enqueue((float)band.Track[i].NoteData[j].Tick * timePerTick); createInfo[i - 1].Enqueue(band.Track[i].NoteData[j].Param1); } } StartCoroutine(setLoadTime()); }