Example #1
0
        public bool update(IEnumerable <Field> paramFields) //returns number of retries
        {
            //update if subresponses have changed
            bool changed = false;

            foreach (Field f in paramFields)
            {
                SubResponse found = subResponses.SingleOrDefault(s => s.index == f.subQuestionIndex);
                if (found == null)
                {
                    subResponses.Add(new SubResponse(f.Value, f.subQuestionIndex));
                    changed = true;
                }
                else
                {
                    if (f.Value != found.Text)
                    {
                        found.Text = f.Value;
                        changed    = true;
                    }
                }
            }

            if (changed)
            {
                Retries++;
            }
            return(changed);
        }
Example #2
0
        //public string feedback { get { return _text[1]; } }


        public void checkScore(SubResponse subresponse, IEnumerable <SubResponse> _responses)
        {
            //if markdown is checkbox, then responseiscorrect tests whether true
            //if markdown is input, responseiscorrect tests equality

            if (responseIsCorrect(subresponse.Text, _responses.Select(r => r.Text)))
            {
                subresponse.Score = 1;
            }
            else
            {
                subresponse.Score = 0;
            }
            subresponse.decision = AME_base.SubResponse.Decision.decided; //adjusts decision state
        }
Example #3
0
        public ResponseElementSummary(ObservableCollection<SubResponse> ResponseElements) :
            base((from SubResponse re in ResponseElements
                         select re.Text)
                            .Distinct()
                            .Select(g => new ResponseElementSummaryItem(g, ResponseElements))
                            .OrderByDescending(res => res.totalWithSameText))
        {
            //if a completely new text is added, then create a new summary
            ResponseElements.CollectionChanged += (sender, e) =>
            {
                if (e.NewItems != null)
                {
                    SubResponse re = e.NewItems[0] as SubResponse;
                    if (!Items.Any(res => res.text == re.Text))
                        Add(new ResponseElementSummaryItem(re.Text, ResponseElements));
                }
            };

            //ResponseElementsummary contains event to update when ResponseElements are changed
        }
 public SubResponseViewModel(SubResponse t)
 {
     _entity = t;
 }