Surveys - sms-trevature/user-interface GitHub Wiki

Survey-Creator Component

Purpose

The Survey-Creator Component is utilized to provide an easily navigatable survey creator. This is mainly utilized to create custom survey templates.

Issues

  • This component was complex in some aspects. There is also a vast amount of overloading. No current issues with implementation.

Future Iterations

This component could utilize some better interaction with the client. Possibilities include moving the client to another component after the survey has been created.

Technologies

You will need Bootstrap to get the proper visuals for the component.

Survey-Grid Component (Template)

Purpose

This component is designed to view all the survey templates. This will also generate the survey from the existing templates.

Issues

  • Whenever you want to regenerate a survey from the template you need to also push the survey question conjunction. This is for all survey question conjunctions.
  • Currently, the survey template (when the window is minimized), stacks the input text boxes on top of each other, making the formatting look unprofessional.

Future Iterations

There could be better optimizations to the existing code.

Technologies

You will need Bootstrap to get the proper visuals for this component.

Survey-List Component

Purpose

This component is to show the ready to be assigned surveys. You can assign surveys by cohort, status, or email. This component shows respondents and can also generate graphs based on response data.

Issues

  • When you assign via different groups there may be duplicate emails. Avoid duplication on email sending.
  • The generation of graphs is a complex nested loop.

Future Iterations

Optimize the algorithm for generating groups or changing the model within the database.

Technologies

This component requires ng2-charts and bootstrap.

Assign-Survey Component

Purpose

Any survey that has been assigned will be visible within this component. You can answer your surveys in this component as well.

Issues

  • Had to implement new input types for example radio buttons, checkboxes, input text boxes.
  • Had to have a loop of answers within a loop of questions. Hard to get back responses.

Future Iterations

Optimization of code to generate a response from the client. Try to utilize Angular survey dependency.

Technologies

You need bootstrap to visualize this component properly.

Survey Service Related Issues

Optimal code is hard to accomplish since the model of the service is defined in the way that table link to each other without one table connecting everything.

Create Template

In this scenario, models including Question, Answer, SurveyQuestionConjuction, and Survey are needed. We need to push our Survey with survey id equals to null to the database first and re-fetch from the database to get the correct survey id,and then we can have a for loop that in each iteration we push one question In Question data type, and fetch again from the database to get correct question id and put the question and survey together into our SurveyQuestionConjuction model and push to database. And then, we need to push a list of possible answers related to the current question. Here another thing that can be challenged may be that first, since, for Question type, we need to have its id, the Question type, where, in our database, we defined that there is only going to be 7 types of them, each has a corresponding answer list or client customed answer list. For type as boolean, multiple choice, rating, etc we need to show radio button on the survey, while there is also checkbox multiple choice type where the client can choose multiple answers at the same time. And the possible answers are abled for clients to design themselves.

Create Survey from Template

Since in our database, tables are linked to each other, we need to be careful when we want to save an object. Since, further steps such as saving related objects may be necessary The Survey model only has a field of its id, title, description, dateCreated, closing date, template and published, where template and published are both boolean value with the opposite value of each other. This is meaning that whenever we create a template, it should not appear in the survey list component but on the template list component. Moreover, we have SurveyQuestionConjunction model that has the field of its id, Survey, Question, and question order as a number type. In this case, Question is another model in Survey Service. So this means whenever we want to publish a template to be a ready-to-be-assigned Survey, we need to push both current Surveys, and it's related SurveyQuestionConjunction. Noted that in the Survey part of the SurveyQuestionConjunction field, Survey id is going to be reassigned after being pushed to the database with switched true false value for template and publish. So we need to grab the new SurveyId that is sending back from HTTP response, and put that new Survey into SurveyQuestionConjunction model, and push the SurveyQuestionConjunction model.