/*num番目問題にアップデートする*/ void UpdateQuestion(int num) { //クリア ClearQuestion(); //現在の問題 curQues = questions[num]; //タイプによって問題を設定 SetQuestion setQues = null; switch (curQues.type) { case 1: setQues = new SetQuestion(SetQuestion_type1); break; case 2: case 3: setQues = new SetQuestion(SetQuestion_type2); break; //別のタイプを追加する場合は新しい関数か、適する関数を呼出す必要がある。 default: setQues = new SetQuestion(SetQuestion_type2); break; } setQues(curQues); ManagerObj.status = SolveStatus.Solving; Debug.Log(ManagerObj.status); }
public async Task <ActionResult <SetQuestion> > PostSetQuestion(int setId, int termId, int roleId, [FromBody] SetQuestionIM item) { var set = await _context.Sets.FindAsync(setId); if (set == null) { return(NotFound("set not found")); } var @role = await _context.SetRoles.FindAsync(roleId); if (@role == null) { return(NotFound("role not found")); } var @term = await _context.SetTerms.FindAsync(termId); if (@term == null) { return(NotFound("term not found")); } if (term.SetId != set.Id && role.SetId != set.Id) { return(BadRequest("role or term is outside this set")); } int maxQuestionOrder; try { maxQuestionOrder = _context.SetQuestions.Where(sq => sq.SetRoleId == roleId && sq.SetTermId == termId).Max(sq => sq.Order) + 1; } catch { maxQuestionOrder = 0; } var newQuestion = new SetQuestion { SetTermId = termId, SetRoleId = roleId, Text = item.Text, Description = item.Description, Points = item.Points, Order = maxQuestionOrder }; _context.SetQuestions.Add(newQuestion); await _context.SaveChangesAsync(); return(Ok(newQuestion)); }
public async Task <ApiResponse> UpdateQuestonsAsync([FromBody] SetQuestion model) { try { var result = await _questionService.CrudService.UpdateAsync(model); return(HttpResponse(200, "", result)); } catch (Exception e) { _logger.Log(LogType.Error, () => e.Message, e); return(HttpResponse(500, e.Message)); } }
public void AddQuestion([FromBody] AddQuestionsRequest request) { ModuleBuilderManager m = new ModuleBuilderManager(); foreach (QuestionAdd add in request.QuestionList) { SetQuestion r = new SetQuestion { SetName = request.SetName, RequirementID = request.RequirementID, QuestionID = add.QuestionID, SalLevels = add.SalLevels }; m.AddQuestion(r); } }
// 次の問題を出題 void notifyNextQuestion(int forceAstId = -1) { // 現状をセーブ save(); if (curAnswerNum_ >= 89) { // 全て開けている nextState_ = new Ending(this); return; } // データセット作成 dataSet_ = new DataSet(); dataSet_.astId_ = forceAstId >= 1 ? forceAstId : questionAstIds_[curAnswerNum_]; dataSet_.radius_ = radius_; dataSet_.sky_ = sky_; dataSet_.selectMode_ = selectMode_; nextState_ = new SetQuestion(this, dataSet_); }
public void RemoveQuestion([FromBody] SetQuestion request) { ModuleBuilderManager m = new ModuleBuilderManager(); m.RemoveQuestion(request); }
public void AddCustomQuestion([FromBody] SetQuestion request) { ModuleBuilderManager m = new ModuleBuilderManager(); m.AddCustomQuestion(request); }