Exemplo n.º 1
0
def change_remark_label_for_end_user():
    end_user_flow = Flow.objects.filter(label=Flow.Label.END_USER)
    satisfaction_question = Question.objects.filter(label='feedbackAboutSatisfaction', flow=end_user_flow)
    if satisfaction_question.exists():
        satisfaction_question.update(label=Question.LABEL.additionalDeliveryComments)
    else:
        Question.build_question(TextQuestion, text='Additional Remarks',
                                label=Question.LABEL.additionalDeliveryComments,
                                flow=end_user_flow, position=6)
Exemplo n.º 2
0
def change_remark_label_for_middleman():
    middleman = Flow.objects.filter(label=Flow.Label.MIDDLE_MAN)
    additional_remarks = Question.objects.filter(label='additionalComments', flow=middleman)
    if additional_remarks.exists():
        additional_remarks.update(label=Question.LABEL.additionalDeliveryComments)
    else:
        Question.build_question(TextQuestion, text='Additional Remarks',
                                label=Question.LABEL.additionalDeliveryComments,
                                flow=middleman, position=4)
Exemplo n.º 3
0
def seed_ip_questions():
    ip_flow, _ = Flow.objects.get_or_create(label=Flow.Label.IMPLEMENTING_PARTNER)
    ip_flow.temp_end_nodes = []
    ip_flow.final_end_nodes = []
    ip_flow.optional_end_nodes = []

    ip_question_1 = Question.build_question(MultipleChoiceQuestion, text='Was delivery received?',
                                            label=Question.LABEL.deliveryReceived, flow=ip_flow, position=1)
    ip_yes = Option.build_option(text='Yes', question=ip_question_1)
    ip_no = Option.build_option(text='No', question=ip_question_1)
    ip_flow.final_end_nodes.append([ip_question_1.id, ip_no.id])
    ip_flow.save()

    ip_question_2 = Question.build_question(TextQuestion, text='When was delivery received?',
                                            label=Question.LABEL.dateOfReceipt, flow=ip_flow, position=2)

    ip_question_3 = Question.build_question(MultipleChoiceQuestion, text='Was delivery in good condition?',
                                            label=Question.LABEL.isDeliveryInGoodOrder, flow=ip_flow, position=3)
    in_good_condition_yes = Option.build_option(text='Yes', question=ip_question_3)
    in_good_condition_no = Option.build_option(text='No', question=ip_question_3)

    ip_question_4 = Question.build_question(MultipleChoiceQuestion, text="Are you satisfied with the delivery?",
                                            label=Question.LABEL.satisfiedWithDelivery, flow=ip_flow, position=4)
    satisfied = Option.build_option(text="Yes", question=ip_question_4)
    not_satisfied = Option.build_option(text="No", question=ip_question_4)
    ip_flow.temp_end_nodes.append([ip_question_4.id, satisfied.id])
    ip_flow.temp_end_nodes.append([ip_question_4.id, not_satisfied.id])
    ip_flow.save()

    ip_question_5 = Question.build_question(TextQuestion, text='Additional Remarks',
                                            label=Question.LABEL.additionalDeliveryComments, flow=ip_flow, position=5)

    ip_flow.optional_end_nodes.append([ip_question_5.id, Flow.NO_OPTION])
    ip_flow.save()

    questions = {
        'WAS_DELIVERY_RECEIVED': ip_question_1,
        'DATE_OF_RECEIPT': ip_question_2,
        'IS_DELIVERY_IN_GOOD_ORDER': ip_question_3,
        'SATISFIED_WITH_DELIVERY': ip_question_4,
        'ADDITIONAL_DELIVERY_COMMENTS': ip_question_5
    }

    options = {
        'DELIVERY_WAS_RECEIVED': ip_yes,
        'DELIVERY_WAS_NOT_RECEIVED': ip_no,
        'IN_GOOD_CONDITION': in_good_condition_yes,
        'NOT_IN_GOOD_CONDITION': in_good_condition_no,
        'SATISFIED': satisfied,
        'NOT_SATISFIED': not_satisfied
    }

    return questions, options, ip_flow
Exemplo n.º 4
0
def change_remark_label_for_middleman():
    middleman = Flow.objects.filter(label=Flow.Label.MIDDLE_MAN)
    additional_remarks = Question.objects.filter(label='additionalComments',
                                                 flow=middleman)
    if additional_remarks.exists():
        additional_remarks.update(
            label=Question.LABEL.additionalDeliveryComments)
    else:
        Question.build_question(
            TextQuestion,
            text='Additional Remarks',
            label=Question.LABEL.additionalDeliveryComments,
            flow=middleman,
            position=4)
Exemplo n.º 5
0
def change_remark_label_for_end_user():
    end_user_flow = Flow.objects.filter(label=Flow.Label.END_USER)
    satisfaction_question = Question.objects.filter(
        label='feedbackAboutSatisfaction', flow=end_user_flow)
    if satisfaction_question.exists():
        satisfaction_question.update(
            label=Question.LABEL.additionalDeliveryComments)
    else:
        Question.build_question(
            TextQuestion,
            text='Additional Remarks',
            label=Question.LABEL.additionalDeliveryComments,
            flow=end_user_flow,
            position=6)
Exemplo n.º 6
0
def seed_questions():
    global WAS_PRODUCT_RECEIVED, PRODUCT_WAS_RECEIVED, PRODUCT_WAS_NOT_RECEIVED, EU_DATE_RECEIVED, EU_AMOUNT_RECEIVED
    global EU_QUALITY_OF_PRODUCT, EU_SATISFACTION, EU_INFORMED_OF_DELAY, EU_REVISED_DELIVERY_DATE, EU_OPT_EXPIRED
    global EU_OPT_DAMAGED, EU_OPT_GOOD, EU_OPT_SATISFIED, EU_OPT_NOT_SATISFIED
    global EU_DISSATISFACTION_FEEDBACK, EU_SATISFACTION_FEEDBACK, EU_NOTGOODCOMMENT_FEEDBACK
    global END_USER_FLOW

    END_USER_FLOW, _ = Flow.objects.get_or_create(label=Flow.Label.END_USER)
    END_USER_FLOW.end_nodes = []

    WAS_PRODUCT_RECEIVED = Question.build_question(MultipleChoiceQuestion, text='Was product received?',
                                                   label='productReceived', flow=END_USER_FLOW, position=1)
    PRODUCT_WAS_RECEIVED = Option.build_option(text='Yes', question=WAS_PRODUCT_RECEIVED)
    PRODUCT_WAS_NOT_RECEIVED = Option.build_option(text='No', question=WAS_PRODUCT_RECEIVED)

    EU_DATE_RECEIVED = Question.build_question(TextQuestion, text='What date was it received?', label='dateOfReceipt',
                                               flow=END_USER_FLOW, position=2)

    EU_INFORMED_OF_DELAY = Question.build_question(MultipleChoiceQuestion, text='Have you been informed of the delay?',
                                                   label='informedOfDelay', flow=END_USER_FLOW, position=2)
    eu_informed_of_delay_yes = Option.build_option(text='Yes', question=EU_INFORMED_OF_DELAY)
    eu_informed_of_delay_no = Option.build_option(text='No', question=EU_INFORMED_OF_DELAY)
    END_USER_FLOW.end_nodes.append([EU_INFORMED_OF_DELAY.id, eu_informed_of_delay_no.id])
    END_USER_FLOW.save()

    EU_AMOUNT_RECEIVED = Question.build_question(NumericQuestion, text='How much was received?',
                                                 label='amountReceived', flow=END_USER_FLOW, position=3)

    EU_REVISED_DELIVERY_DATE = Question.build_question(TextQuestion,
                                                       text='What did the partner say is the revised delivery date?',
                                                       label='revisedDeliveryDate', flow=END_USER_FLOW, position=3)
    END_USER_FLOW.end_nodes.append([EU_REVISED_DELIVERY_DATE.id, Flow.NO_OPTION])
    END_USER_FLOW.save()

    EU_QUALITY_OF_PRODUCT = Question.build_question(MultipleChoiceQuestion, text='What is the quality of the product?',
                                                    label='qualityOfProduct', flow=END_USER_FLOW, position=4)
    EU_OPT_GOOD = Option.build_option(text='Good', question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_DAMAGED = Option.build_option(text='Damaged', question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_SUBSTANDARD = Option.build_option(text='Substandard', question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_EXPIRED = Option.build_option(text='Expired', question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_INCOMPLETE = Option.build_option(text='Incomplete', question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_OTHER = Option.build_option(text='Other', question=EU_QUALITY_OF_PRODUCT)
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_DAMAGED.id])
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_SUBSTANDARD.id])
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_EXPIRED.id])
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_INCOMPLETE.id])
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_OTHER.id])
    END_USER_FLOW.save()

    EU_SATISFACTION = Question.build_question(MultipleChoiceQuestion, text='Are you satisfied with the product?',
                                              label='satisfiedWithProduct', flow=END_USER_FLOW, position=5)
    EU_OPT_SATISFIED = Option.build_option(text='Yes', question=EU_SATISFACTION)
    EU_OPT_NOT_SATISFIED = Option.build_option(text='No', question=EU_SATISFACTION)
    END_USER_FLOW.end_nodes.append([EU_SATISFACTION.id, EU_OPT_SATISFIED.id])
    END_USER_FLOW.end_nodes.append([EU_SATISFACTION.id, EU_OPT_NOT_SATISFIED.id])
    END_USER_FLOW.save()

    EU_NOTGOODCOMMENT_FEEDBACK = Question.build_question(TextQuestion, text='Feedback about Not good',
                                                         label='notGoodComment', flow=END_USER_FLOW, position=5)

    EU_SATISFACTION_FEEDBACK = Question.build_question(TextQuestion, text='Feedback about Satisfaction',
                                                       label='feedbackAboutSatisfaction',
                                                       flow=END_USER_FLOW, position=6)

    EU_DISSATISFACTION_FEEDBACK = Question.build_question(TextQuestion, text='Feedback about Dissatisfaction',
                                                          label='feedbackAboutDissatisfaction',
                                                          flow=END_USER_FLOW, position=6)

    questions = {
        'WAS_PRODUCT_RECEIVED': WAS_PRODUCT_RECEIVED,
        'QUALITY_OF_PRODUCT': EU_QUALITY_OF_PRODUCT,
        'SATISFACTION_WITH_PRODUCT': EU_SATISFACTION,
        'AMOUNT_RECEIVED': EU_AMOUNT_RECEIVED,
        'DATE_RECEIVED': EU_DATE_RECEIVED,
        'INFORMED_OF_DELAY': EU_INFORMED_OF_DELAY,
        'REVISED_DELIVERY_DATE': EU_REVISED_DELIVERY_DATE,
        'NOT_GOOD_FEEDBACK': EU_NOTGOODCOMMENT_FEEDBACK,
        'SATISFACTION_FEEDBACK': EU_SATISFACTION_FEEDBACK,
        'DISSATISFACTION_FEEDBACK': EU_DISSATISFACTION_FEEDBACK
    }
    options = {
        'PRODUCT_WAS_RECEIVED': PRODUCT_WAS_RECEIVED,
        'PRODUCT_WAS_NOT_RECEIVED': PRODUCT_WAS_NOT_RECEIVED,
        'IN_GOOD_CONDITION': EU_OPT_GOOD,
        'DAMAGED': EU_OPT_DAMAGED,
        'SUB_STANDARD': EU_OPT_SUBSTANDARD,
        'EXPIRED': EU_OPT_EXPIRED,
        'INCOMPLETE': EU_OPT_INCOMPLETE,
        'OTHER': EU_OPT_OTHER,
        'SATISFIED': EU_OPT_SATISFIED,
        'NOT_SATISFIED': EU_OPT_NOT_SATISFIED,
        'WAS_INFORMED_OF_DELAY': eu_informed_of_delay_yes,
        'NOT_INFORMED_OF_DELAY': eu_informed_of_delay_no
    }
    return questions, options
Exemplo n.º 7
0
from eums.models import MultipleChoiceQuestion, Option, TextQuestion, NumericQuestion, Flow, Question

middle_man_flow, _ = Flow.objects.get_or_create(label=Flow.Label.MIDDLE_MAN)

middle_man_flow.temp_end_nodes = []
middle_man_flow.final_end_nodes = []
middle_man_flow.optional_end_nodes = []

mm_question_1 = Question.build_question(MultipleChoiceQuestion,
                                        text='Was product received?',
                                        label='productReceived',
                                        flow=middle_man_flow,
                                        position=1)
mm_q1_option_1 = Option.build_option(text='Yes', question=mm_question_1)
mm_q1_option_2 = Option.build_option(text='No', question=mm_question_1)

mm_question_2 = Question.build_question(TextQuestion,
                                        text='When was item received?',
                                        label='dateOfReceipt',
                                        flow=middle_man_flow,
                                        position=2)

mm_question_3 = Question.build_question(NumericQuestion,
                                        text='What is the amount received?',
                                        label='amountReceived',
                                        flow=middle_man_flow,
                                        position=3)
middle_man_flow.temp_end_nodes.append([mm_question_3.id, Flow.NO_OPTION])

mm_question_4 = Question.build_question(MultipleChoiceQuestion,
                                        text='Were you informed of the delay?',
Exemplo n.º 8
0
def seed_questions():
    global WAS_PRODUCT_RECEIVED, PRODUCT_WAS_RECEIVED, PRODUCT_WAS_NOT_RECEIVED, EU_DATE_RECEIVED, EU_AMOUNT_RECEIVED
    global EU_QUALITY_OF_PRODUCT, EU_SATISFACTION, EU_INFORMED_OF_DELAY, EU_REVISED_DELIVERY_DATE, EU_OPT_EXPIRED
    global EU_OPT_DAMAGED, EU_OPT_GOOD, EU_OPT_SATISFIED, EU_OPT_NOT_SATISFIED
    global EU_ADDITIONAL_REMARK
    global END_USER_FLOW

    END_USER_FLOW, _ = Flow.objects.get_or_create(label=Flow.Label.END_USER)
    END_USER_FLOW.end_nodes = []

    WAS_PRODUCT_RECEIVED = Question.build_question(
        MultipleChoiceQuestion,
        text='Was product received?',
        label='productReceived',
        flow=END_USER_FLOW,
        position=1)
    PRODUCT_WAS_RECEIVED = Option.build_option(text='Yes',
                                               question=WAS_PRODUCT_RECEIVED)
    PRODUCT_WAS_NOT_RECEIVED = Option.build_option(
        text='No', question=WAS_PRODUCT_RECEIVED)

    EU_DATE_RECEIVED = Question.build_question(
        TextQuestion,
        text='What date was it received?',
        label='dateOfReceipt',
        flow=END_USER_FLOW,
        position=2)

    EU_INFORMED_OF_DELAY = Question.build_question(
        MultipleChoiceQuestion,
        text='Have you been informed of the delay?',
        label='informedOfDelay',
        flow=END_USER_FLOW,
        position=2)
    eu_informed_of_delay_yes = Option.build_option(
        text='Yes', question=EU_INFORMED_OF_DELAY)
    eu_informed_of_delay_no = Option.build_option(
        text='No', question=EU_INFORMED_OF_DELAY)
    END_USER_FLOW.end_nodes.append(
        [EU_INFORMED_OF_DELAY.id, eu_informed_of_delay_no.id])
    END_USER_FLOW.save()

    EU_AMOUNT_RECEIVED = Question.build_question(NumericQuestion,
                                                 text='How much was received?',
                                                 label='amountReceived',
                                                 flow=END_USER_FLOW,
                                                 position=3)

    EU_REVISED_DELIVERY_DATE = Question.build_question(
        TextQuestion,
        text='What did the partner say is the revised delivery date?',
        label='revisedDeliveryDate',
        flow=END_USER_FLOW,
        position=3)
    END_USER_FLOW.end_nodes.append(
        [EU_REVISED_DELIVERY_DATE.id, Flow.NO_OPTION])
    END_USER_FLOW.save()

    EU_QUALITY_OF_PRODUCT = Question.build_question(
        MultipleChoiceQuestion,
        text='What is the quality of the product?',
        label='qualityOfProduct',
        flow=END_USER_FLOW,
        position=4)
    EU_OPT_GOOD = Option.build_option(text='Good',
                                      question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_DAMAGED = Option.build_option(text='Damaged',
                                         question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_SUBSTANDARD = Option.build_option(text='Substandard',
                                             question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_EXPIRED = Option.build_option(text='Expired',
                                         question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_INCOMPLETE = Option.build_option(text='Incomplete',
                                            question=EU_QUALITY_OF_PRODUCT)
    EU_OPT_OTHER = Option.build_option(text='Other',
                                       question=EU_QUALITY_OF_PRODUCT)
    END_USER_FLOW.end_nodes.append(
        [EU_QUALITY_OF_PRODUCT.id, EU_OPT_DAMAGED.id])
    END_USER_FLOW.end_nodes.append(
        [EU_QUALITY_OF_PRODUCT.id, EU_OPT_SUBSTANDARD.id])
    END_USER_FLOW.end_nodes.append(
        [EU_QUALITY_OF_PRODUCT.id, EU_OPT_EXPIRED.id])
    END_USER_FLOW.end_nodes.append(
        [EU_QUALITY_OF_PRODUCT.id, EU_OPT_INCOMPLETE.id])
    END_USER_FLOW.end_nodes.append([EU_QUALITY_OF_PRODUCT.id, EU_OPT_OTHER.id])
    END_USER_FLOW.save()

    EU_SATISFACTION = Question.build_question(
        MultipleChoiceQuestion,
        text='Are you satisfied with the product?',
        label='satisfiedWithProduct',
        flow=END_USER_FLOW,
        position=5)
    EU_OPT_SATISFIED = Option.build_option(text='Yes',
                                           question=EU_SATISFACTION)
    EU_OPT_NOT_SATISFIED = Option.build_option(text='No',
                                               question=EU_SATISFACTION)
    END_USER_FLOW.end_nodes.append([EU_SATISFACTION.id, EU_OPT_SATISFIED.id])
    END_USER_FLOW.end_nodes.append(
        [EU_SATISFACTION.id, EU_OPT_NOT_SATISFIED.id])
    END_USER_FLOW.save()

    EU_ADDITIONAL_REMARK = Question.build_question(
        TextQuestion,
        text='Additional Remarks',
        label=Question.LABEL.additionalDeliveryComments,
        flow=END_USER_FLOW,
        position=6)

    questions = {
        'WAS_PRODUCT_RECEIVED': WAS_PRODUCT_RECEIVED,
        'QUALITY_OF_PRODUCT': EU_QUALITY_OF_PRODUCT,
        'SATISFACTION_WITH_PRODUCT': EU_SATISFACTION,
        'AMOUNT_RECEIVED': EU_AMOUNT_RECEIVED,
        'DATE_RECEIVED': EU_DATE_RECEIVED,
        'INFORMED_OF_DELAY': EU_INFORMED_OF_DELAY,
        'REVISED_DELIVERY_DATE': EU_REVISED_DELIVERY_DATE,
        'ADDITIONAL_REMARK': EU_ADDITIONAL_REMARK
    }
    options = {
        'PRODUCT_WAS_RECEIVED': PRODUCT_WAS_RECEIVED,
        'PRODUCT_WAS_NOT_RECEIVED': PRODUCT_WAS_NOT_RECEIVED,
        'IN_GOOD_CONDITION': EU_OPT_GOOD,
        'DAMAGED': EU_OPT_DAMAGED,
        'SUB_STANDARD': EU_OPT_SUBSTANDARD,
        'EXPIRED': EU_OPT_EXPIRED,
        'INCOMPLETE': EU_OPT_INCOMPLETE,
        'OTHER': EU_OPT_OTHER,
        'SATISFIED': EU_OPT_SATISFIED,
        'NOT_SATISFIED': EU_OPT_NOT_SATISFIED,
        'WAS_INFORMED_OF_DELAY': eu_informed_of_delay_yes,
        'NOT_INFORMED_OF_DELAY': eu_informed_of_delay_no
    }
    return questions, options
Exemplo n.º 9
0
def seed_ip_questions():
    ip_flow, _ = Flow.objects.get_or_create(
        label=Flow.Label.IMPLEMENTING_PARTNER)
    ip_flow.temp_end_nodes = []
    ip_flow.final_end_nodes = []
    ip_flow.optional_end_nodes = []

    ip_question_1 = Question.build_question(
        MultipleChoiceQuestion,
        text='Was delivery received?',
        label=Question.LABEL.deliveryReceived,
        flow=ip_flow,
        position=1)
    ip_yes = Option.build_option(text='Yes', question=ip_question_1)
    ip_no = Option.build_option(text='No', question=ip_question_1)
    ip_flow.final_end_nodes.append([ip_question_1.id, ip_no.id])
    ip_flow.save()

    ip_question_2 = Question.build_question(TextQuestion,
                                            text='When was delivery received?',
                                            label=Question.LABEL.dateOfReceipt,
                                            flow=ip_flow,
                                            position=2)

    ip_question_3 = Question.build_question(
        MultipleChoiceQuestion,
        text='Was delivery in good condition?',
        label=Question.LABEL.isDeliveryInGoodOrder,
        flow=ip_flow,
        position=3)
    in_good_condition_yes = Option.build_option(text='Yes',
                                                question=ip_question_3)
    in_good_condition_no = Option.build_option(text='No',
                                               question=ip_question_3)

    ip_question_4 = Question.build_question(
        MultipleChoiceQuestion,
        text="Are you satisfied with the delivery?",
        label=Question.LABEL.satisfiedWithDelivery,
        flow=ip_flow,
        position=4)
    satisfied = Option.build_option(text="Yes", question=ip_question_4)
    not_satisfied = Option.build_option(text="No", question=ip_question_4)
    ip_flow.temp_end_nodes.append([ip_question_4.id, satisfied.id])
    ip_flow.temp_end_nodes.append([ip_question_4.id, not_satisfied.id])
    ip_flow.save()

    ip_question_5 = Question.build_question(
        TextQuestion,
        text='Additional Remarks',
        label=Question.LABEL.additionalDeliveryComments,
        flow=ip_flow,
        position=5)

    ip_flow.optional_end_nodes.append([ip_question_5.id, Flow.NO_OPTION])
    ip_flow.save()

    questions = {
        'WAS_DELIVERY_RECEIVED': ip_question_1,
        'DATE_OF_RECEIPT': ip_question_2,
        'IS_DELIVERY_IN_GOOD_ORDER': ip_question_3,
        'SATISFIED_WITH_DELIVERY': ip_question_4,
        'ADDITIONAL_DELIVERY_COMMENTS': ip_question_5
    }

    options = {
        'DELIVERY_WAS_RECEIVED': ip_yes,
        'DELIVERY_WAS_NOT_RECEIVED': ip_no,
        'IN_GOOD_CONDITION': in_good_condition_yes,
        'NOT_IN_GOOD_CONDITION': in_good_condition_no,
        'SATISFIED': satisfied,
        'NOT_SATISFIED': not_satisfied
    }

    return questions, options, ip_flow
Exemplo n.º 10
0
from eums.models import MultipleChoiceQuestion, Option, TextQuestion, NumericQuestion, Flow, Question

middle_man_flow, _ = Flow.objects.get_or_create(label=Flow.Label.MIDDLE_MAN)

middle_man_flow.temp_end_nodes = []
middle_man_flow.final_end_nodes = []
middle_man_flow.optional_end_nodes = []

mm_question_1 = Question.build_question(MultipleChoiceQuestion, text='Was product received?', label='productReceived',
                                        flow=middle_man_flow, position=1)
mm_q1_option_1 = Option.build_option(text='Yes', question=mm_question_1)
mm_q1_option_2 = Option.build_option(text='No', question=mm_question_1)

mm_question_2 = Question.build_question(TextQuestion, text='When was item received?', label='dateOfReceipt',
                                        flow=middle_man_flow, position=2)

mm_question_3 = Question.build_question(NumericQuestion, text='What is the amount received?', label='amountReceived',
                                        flow=middle_man_flow, position=3)
middle_man_flow.temp_end_nodes.append([mm_question_3.id, Flow.NO_OPTION])

mm_question_4 = Question.build_question(MultipleChoiceQuestion, text='Were you informed of the delay?',
                                        label='informedOfDelay', flow=middle_man_flow, position=2)
mm_q4_option_1 = Option.build_option(text='Yes', question=mm_question_4)
mm_q4_option_2 = Option.build_option(text='No', question=mm_question_4)
middle_man_flow.final_end_nodes.append([mm_question_4.id, mm_q4_option_2.id])

mm_question_5 = Question.build_question(TextQuestion, text='When to expect delay?', label='revisedDeliveryDate',
                                        flow=middle_man_flow, position=3)
middle_man_flow.final_end_nodes.append([mm_question_5.id, Flow.NO_OPTION])

mm_question_6 = Question.build_question(TextQuestion, text='Additional Remarks',
Exemplo n.º 11
0
from eums.models import MultipleChoiceQuestion, Option, TextQuestion, NumericQuestion, Flow, Question

middle_man_flow, _ = Flow.objects.get_or_create(label=Flow.Label.MIDDLE_MAN)

middle_man_flow.end_nodes = []

mm_question_1 = Question.build_question(
    MultipleChoiceQuestion, text="Was product received?", label="productReceived", flow=middle_man_flow, position=1
)
mm_q1_option_1 = Option.build_option(text="Yes", question=mm_question_1)
mm_q1_option_2 = Option.build_option(text="No", question=mm_question_1)

mm_question_2 = Question.build_question(
    TextQuestion, text="When was item received?", label="dateOfReceipt", flow=middle_man_flow, position=2
)

mm_question_3 = Question.build_question(
    NumericQuestion, text="What is the amount received?", label="amountReceived", flow=middle_man_flow, position=3
)
middle_man_flow.end_nodes.append([mm_question_3.id, Flow.NO_OPTION])

mm_question_4 = Question.build_question(
    MultipleChoiceQuestion,
    text="Were you informed of the delay?",
    label="informedOfDelay",
    flow=middle_man_flow,
    position=2,
)
mm_q4_option_1 = Option.build_option(text="Yes", question=mm_question_4)
mm_q4_option_2 = Option.build_option(text="No", question=mm_question_4)
middle_man_flow.end_nodes.append([mm_question_4.id, mm_q4_option_2.id])
Exemplo n.º 12
0
from eums.models import MultipleChoiceQuestion, Option, NumericQuestion, TextQuestion, Flow, Question

web_flow, _ = Flow.objects.get_or_create(label=Flow.Label.WEB)

web_question_1 = Question.build_question(MultipleChoiceQuestion, text='Was the item received?', label='itemReceived',
                                         flow=web_flow, when_answered='update_consignee_inventory', position=1)
yes_1 = Option.build_option(text='Yes', question=web_question_1)
no_1 = Option.build_option(text='No', question=web_question_1)

web_question_2 = Question.build_question(NumericQuestion, text='How much was received?', label='amountReceived',
                                         flow=web_flow, when_answered='update_consignee_stock_level', position=2)

web_question_3 = Question.build_question(MultipleChoiceQuestion, text='What is the quality of the product?',
                                         label='qualityOfProduct', flow=web_flow, position=3)
good = Option.build_option(text='Good', question=web_question_3)
damaged = Option.build_option(text='Damaged', question=web_question_3)
substandard = Option.build_option(text='Substandard', question=web_question_3)
expired = Option.build_option(text='Expired', question=web_question_3)
incomplete = Option.build_option(text='Incomplete', question=web_question_3)

web_flow.final_end_nodes = [
    [web_question_3.id, damaged.id],
    [web_question_3.id, substandard.id],
    [web_question_3.id, expired.id],
    [web_question_3.id, incomplete.id]
]
web_flow.save()

web_question_4 = Question.build_question(MultipleChoiceQuestion, text='Are you satisfied with the product?',
                                         label='satisfiedWithProduct', flow=web_flow, position=4)
yes_2 = Option.build_option(text='Yes', question=web_question_4)
Exemplo n.º 13
0
from eums.models import MultipleChoiceQuestion, Option, NumericQuestion, TextQuestion, Flow, Question

web_flow, _ = Flow.objects.get_or_create(label=Flow.Label.WEB)

web_question_1 = Question.build_question(
    MultipleChoiceQuestion,
    text='Was the item received?',
    label='itemReceived',
    flow=web_flow,
    when_answered='update_consignee_inventory',
    position=1)
yes_1 = Option.build_option(text='Yes', question=web_question_1)
no_1 = Option.build_option(text='No', question=web_question_1)

web_question_2 = Question.build_question(
    NumericQuestion,
    text='How much was received?',
    label='amountReceived',
    flow=web_flow,
    when_answered='update_consignee_stock_level',
    position=2)

web_question_3 = Question.build_question(
    MultipleChoiceQuestion,
    text='What is the quality of the product?',
    label='qualityOfProduct',
    flow=web_flow,
    position=3)
good = Option.build_option(text='Good', question=web_question_3)
damaged = Option.build_option(text='Damaged', question=web_question_3)
substandard = Option.build_option(text='Substandard', question=web_question_3)