Created
January 19, 2015 14:55
-
-
Save eagleas/415d175ca4fa83f20e12 to your computer and use it in GitHub Desktop.
export code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Questionary | |
class Main < Serializer | |
def values | |
# Продукт | |
options :product_demand, -> { | |
radio_inherit_a :product_demand, ->(b){ | |
b[0].sub(/Спрос пока не проверяли/i, 'no'). | |
sub(/Спрос проверили, но продаж пока еще нет/i, 'nosale'). | |
sub(/Уже есть продажи/i, 'sale') | |
}, answer_ver(:product_demand, 1=>[2,6],2=>[2,6],3=>[2,4]) do |answer| | |
case answer[0] | |
when /Спрос пока не проверяли/i then; | |
when /Спрос проверили, но продаж пока еще нет/i | |
options_h(:product_demand_nosale_confirm, -> { | |
radio_inherit_a :product_demand_nosale_confirm, ->(b){ | |
b[0].sub(/Посещения/i, 'visit'). | |
sub(/Регистрации/i, 'reg'). | |
sub(/Подписки/i, 'subsc'). | |
sub(/Скачивания/i, 'down'). | |
sub(/Звонки/i, 'call'). | |
sub(/Контакты/i, 'contact'). | |
sub(/Письма/i, 'mail'). | |
sub(/Заявки/i, 'order'). | |
sub(/Контракты\s\/\sДоговора/i, 'contract'). | |
sub(/Проведенные вами опросы/i, 'quest') | |
}, answer[1]['product_demand_testing'] do |ans| | |
case ans[0] | |
when /Посещения/i | |
[ value_h(:product_demand_nosale_confirm_visit_cnt, ans[1]['product_demand_testing_visits_count']), | |
value_h(:product_demand_nosale_confirm_visit_period, ans[1]['product_demand_testing_visits_period']) ] | |
when /Регистрации/i | |
[ value_h(:product_demand_nosale_confirm_reg_cnt, ans[1]['product_demand_testing_registrations_count']), | |
value_h(:product_demand_nosale_confirm_reg_period, ans[1]['product_demand_testing_registrations_period']) ] | |
when /Подписки/i | |
[ value_h(:product_demand_nosale_confirm_subsc_cnt, ans[1]['product_demand_testing_subscribles_count']), | |
value_h(:product_demand_nosale_confirm_subsc_period, ans[1]['product_demand_testing_subscribles_period']) ] | |
when /Скачивания/i | |
[ value_h(:product_demand_nosale_confirm_down_cnt, ans[1]['product_demand_testing_downloads_count']), | |
value_h(:product_demand_nosale_confirm_down_period, ans[1]['product_demand_testing_downloads_period']) ] | |
when /Звонки/i | |
[ value_h(:product_demand_nosale_confirm_call_cnt, ans[1]['product_demand_testing_calls_count']), | |
value_h(:product_demand_nosale_confirm_call_period, ans[1]['product_demand_testing_calls_period']) ] | |
when /Контакты/i | |
[ value_h(:product_demand_nosale_confirm_contact_cnt, ans[1]['product_demand_testing_contacts_count']), | |
value_h(:product_demand_nosale_confirm_contact_period, ans[1]['product_demand_testing_contacts_period']) ] | |
when /Письма/i | |
[ value_h(:product_demand_nosale_confirm_mail_cnt, ans[1]['product_demand_testing_mails_count']), | |
value_h(:product_demand_nosale_confirm_mail_period, ans[1]['product_demand_testing_mails_period']) ] | |
when /Заявки/i | |
[ value_h(:product_demand_nosale_confirm_order_cnt, ans[1]['product_demand_testing_request_count']), | |
value_h(:product_demand_nosale_confirm_order_period, ans[1]['product_demand_testing_request_period']) ] | |
when /Контракты\s\/\sДоговора/i | |
[ value_h(:product_demand_nosale_confirm_contract_cnt, ans[1]['product_demand_testing_contracts_count']), | |
value_h(:product_demand_nosale_confirm_contract_period, ans[1]['product_demand_testing_contracts_period']) ] | |
when /Проведенные вами опросы/i | |
[ value_h(:product_demand_nosale_confirm_quest_cnt, ans[1]['product_demand_testing_polls_count'] ), | |
value_h(:product_demand_nosale_confirm_quest_interest, ans[1]['product_demand_testing_polls_interested'] ) ] | |
end | |
end | |
}) | |
when /Уже есть продажи/i then; | |
else | |
raise ValueError.new, val | |
end | |
end | |
} # options :product_demand | |
options :product_unique_item, -> { | |
radio_inherit_a :product_unique_item, ->(b){ | |
return unless b | |
b.sub('Да', 'yes').sub('Нет','no') | |
}, (answer_ver(:unique_technology, 1=>[2,4], 2=>[2,4])[0] rescue nil) do |ans| | |
case ans | |
when 'Да' | |
[ value_h(:product_unique_owner, nil), | |
value_h(:product_unique_idea, nil) ] | |
end | |
end | |
} | |
value(:product_can_copy_list, nil) | |
# Монетизация | |
options :money_model, -> { | |
checkbox_inherit_a(:money_model, ->(b){ | |
return nil if b =~ /Электронная коммерция/i | |
b.sub(/Реклама/i, 'adv'). | |
sub(/Подписка/i, 'subsc'). | |
sub(/.*(Freemium|встроенные покупки).*/i, 'freem'). | |
sub(/Лидогенерация/i, 'lead'). | |
sub(/.*(Транзакционная|Оплата за услугу).*/i, 'svcpay'). | |
sub(/Комиссия с продаж/i, 'comiss'). | |
sub(/Продажа лицензий/i, 'lic'). | |
sub(/Другая/i, 'other') | |
}, answer_ver(:businessmodel, 1=>[6,3], 2=>[6,3], 3=>[6,2])) do |key, answer| | |
case key | |
when /Реклама/i | |
[ | |
value_h(:money_model_adv_payer, answer['businessmodel_adwards_clients']), | |
options_h(:money_model_adv_tested, ->{ | |
radio_a(:money_model_adv_tested, [true, false], ->{ | |
case answer['businessmodel_adwards_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |ans| | |
case ans | |
when true | |
[ value_h(:money_model_adv_income, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_how']), | |
value_h(:money_model_adv_period, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_period']), | |
value_h(:money_model_adv_dau, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_dau']), | |
value_h(:money_model_adv_mau, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_mau']), | |
value_h(:money_model_adv_count, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_growth']), | |
value_h(:money_model_adv_cpa, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_yes_cpa']), | |
value_h(:money_model_adv_pay_count, | |
nil), | |
value_h(:money_model_adv_avg_price, | |
nil) ] | |
when false | |
[ value_h(:money_model_adv_no_start, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_no_what']), | |
value_h(:money_model_adv_start_date, | |
answer['businessmodel_adwards_confirm'][1]['businessmodel_adwards_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /Подписка/i | |
[ value_h(:money_model_subsc_payer, answer['businessmodel_subscription_clients']), | |
options_h(:money_model_subsc_tested, ->{ | |
radio_a(:money_model_subsc_tested, [true, false], ->{ | |
case answer['businessmodel_subscription_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_subscription_confirm'][1] | |
case answ | |
when true | |
[ value_h(:money_model_subsc_income, | |
ans['businessmodel_subscription_confirm_yes_how']), | |
value_h(:money_model_subsc_period, | |
ans['businessmodel_subscription_confirm_yes_period']), | |
value_h(:money_model_subsc_pay, | |
ans['businessmodel_subscription_confirm_yes_buyers']), | |
value_h(:money_model_subsc_conv, | |
ans['businessmodel_subscription_confirm_yes_conversion']), | |
value_h(:money_model_subsc_stoim, | |
ans['businessmodel_subscription_confirm_yes_price']), | |
value_h(:money_model_subsc_life, | |
ans['businessmodel_subscription_confirm_yes_ltv']), | |
value_h(:money_model_subsc_new_att, | |
ans['businessmodel_subscription_confirm_yes_cpa']) ] | |
when false | |
[ value_h(:money_model_subsc_no_start, | |
ans['businessmodel_subscription_confirm_no_what']), | |
value_h(:money_model_subsc_start_date, | |
ans['businessmodel_subscription_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /(Freemium|Встроенные покупки)/i | |
[ value_h(:money_model_freem_payer, answer['businessmodel_freemium_clients'] || answer['businessmodel_in_app_purchases_clients']), | |
options_h(:money_model_freem_tested, ->{ | |
radio_a(:money_model_freem_tested, [true, false], ->{ | |
ans = answer['businessmodel_freemium_confirm'] || answer['businessmodel_in_app_purchases_confirm'] | |
case ans[0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |ans_bool| | |
ans = answer['businessmodel_freemium_confirm'] || answer['businessmodel_in_app_purchases_confirm'] | |
case ans_bool | |
when true | |
[ value_h(:money_model_freem_income, | |
ans[1]['businessmodel_freemium_confirm_yes_how'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_how']), | |
value_h(:money_model_freem_period, | |
ans[1]['businessmodel_freemium_confirm_yes_period'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_period']), | |
value_h(:money_model_freem_reg, | |
ans[1]['businessmodel_freemium_confirm_yes_registred'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_registrations']), | |
value_h(:money_model_freem_pay, | |
ans[1]['businessmodel_freemium_confirm_yes_buyers'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_buyers']), | |
value_h(:money_model_freem_conv, | |
ans[1]['businessmodel_freemium_confirm_yes_conversion'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_conversion']), | |
value_h(:money_model_freem_avg_pay_cnt, | |
ans[1]['businessmodel_freemium_confirm_yes_average_buys'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_apc']), | |
value_h(:money_model_freem_avg, | |
ans[1]['businessmodel_freemium_confirm_yes_average_price'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_average_price']), | |
value_h(:money_model_freem_new_avg_lifetime, | |
ans[1]['businessmodel_freemium_confirm_yes_average_user_life'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_average_lifetime']), | |
value_h(:money_model_freem_new_avg_att, | |
ans[1]['businessmodel_freemium_confirm_yes_cpa'] || ans[1]['businessmodel_in_app_purchases_confirm_yes_cpa'])] | |
when false | |
[ value_h(:money_model_freem_no_start, | |
ans[1]['businessmodel_freemium_confirm_no_what'] || ans[1]['businessmodel_in_app_purchases_confirm_no_what']), | |
value_h(:money_model_freem_start_date, | |
ans[1]['businessmodel_freemium_confirm_no_when'] || ans[1]['businessmodel_in_app_purchases_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /Лидогенерация/i | |
[ | |
value_h(:money_model_lead_payer, answer['businessmodel_leadgeneration_clients']), | |
options_h(:money_model_lead_tested, ->{ | |
radio_a(:money_model_lead_tested, [true, false], ->{ | |
case answer['businessmodel_leadgeneration_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_leadgeneration_confirm'][1] | |
case answ | |
when true | |
[ value_h(:money_model_lead_income, | |
ans['businessmodel_leadgeneration_confirm_yes_how']), | |
value_h(:money_model_lead_period, | |
ans['businessmodel_leadgeneration_confirm_yes_period']), | |
value_h(:money_model_lead_pay, | |
ans['businessmodel_leadgeneration_confirm_yes_average_lead_price']), | |
value_h(:money_model_lead_conv, | |
ans['businessmodel_leadgeneration_confirm_yes_conversion']) ] | |
when false | |
[ value_h(:money_model_lead_no_start, | |
ans['businessmodel_leadgeneration_confirm_no_what']), | |
value_h(:money_model_lead_start_date, | |
ans['businessmodel_leadgeneration_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /(Транзакционная|Оплата за услугу)/i | |
[ | |
value_h(:money_model_svcpay_payer, answer['businessmodel_paid_service_clients']), | |
options_h(:money_model_svcpay_tested, ->{ | |
radio_a(:money_model_svcpay_tested, [true, false], ->{ | |
case answer['businessmodel_paid_service_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_paid_service_confirm'][1] | |
case answ | |
when true | |
[ value_h(:money_model_svcpay_income, | |
ans['businessmodel_paid_service_confirm_yes_how']), | |
value_h(:money_model_svcpay_period, | |
ans['businessmodel_paid_service_confirm_yes_period']), | |
value_h(:money_model_svcpay_pay, | |
nil), | |
value_h(:money_model_svcpay_conv, | |
ans['businessmodel_paid_service_confirm_yes_conversion']), | |
value_h(:money_model_svcpay_avg, | |
ans['businessmodel_paid_service_confirm_yes_average_price']), | |
value_h(:money_model_svcpay_new_att, | |
ans['businessmodel_paid_service_confirm_yes_cpa']), | |
value_h(:money_model_svcpay_avg_cnt, | |
ans['businessmodel_paid_service_confirm_yes_apc']), | |
] | |
when false | |
[ value_h(:money_model_svcpay_no_start, | |
ans['businessmodel_paid_service_confirm_no_what']), | |
value_h(:money_model_svcpay_start_date, | |
ans['businessmodel_paid_service_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /Комиссия с продаж/i | |
[ | |
value_h(:money_model_comiss_payer, answer['businessmodel_comission_clients']), | |
options_h(:money_model_comiss_tested, ->{ | |
radio_a(:money_model_comiss_tested, [true, false], ->{ | |
case answer['businessmodel_comission_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_comission_confirm'][1] | |
case answ | |
when true | |
[ value_h(:money_model_comiss_income, | |
ans['businessmodel_comission_confirm_yes_how']), | |
value_h(:money_model_comiss_period, | |
ans['businessmodel_comission_confirm_yes_period']), | |
value_h(:money_model_comiss_amt, | |
ans['businessmodel_comission_confirm_yes_comission']), | |
value_h(:money_model_comiss_avg_ticket, | |
ans['businessmodel_comission_confirm_yes_average_price']), | |
value_h(:money_model_comiss_pay_count, | |
nil), | |
value_h(:money_model_comiss_vol_convers, | |
ans['businessmodel_comission_confirm_yes_conversion']), | |
value_h(:money_model_comiss_avg_price_user, | |
ans['businessmodel_comission_confirm_yes_cpa']), | |
value_h(:money_model_comiss_price_sale, | |
ans['businessmodel_comission_confirm_yes_supplier']), | |
] | |
when false | |
[ value_h(:money_model_comiss_start, | |
ans['businessmodel_comission_confirm_no_what']), | |
value_h(:money_model_comiss_start_date, | |
ans['businessmodel_comission_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /Продажа лицензий/i | |
[ value_h(:money_model_lic_payer, answer['businessmodel_license_sales_clients']), | |
options_h(:money_model_lic_tested, ->{ | |
radio_a(:money_model_lic_tested, [true, false], ->{ | |
case answer['businessmodel_license_sales_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_license_sales_confirm'][1] | |
case answ | |
when true | |
[ value_h(:money_model_lic_income, | |
ans['businessmodel_license_sales_confirm_yes_how']), | |
value_h(:money_model_lic_period, | |
ans['businessmodel_license_sales_confirm_yes_period']), | |
value_h(:money_model_lic_pay, | |
ans['businessmodel_license_sales_confirm_yes_buyers']), | |
value_h(:money_model_lic_no_reg, | |
ans['businessmodel_license_sales_confirm_yes_free_users']), | |
value_h(:money_model_lic_conv, | |
ans['businessmodel_license_sales_confirm_yes_conversion']), | |
value_h(:money_model_lic_avg, | |
ans['businessmodel_license_sales_confirm_yes_average_price']), | |
value_h(:money_model_lic_new_att, | |
ans['businessmodel_license_sales_confirm_yes_cpa']), | |
value_h(:money_model_lic_new_avg_lifetime, | |
nil), | |
] | |
when false | |
[ value_h(:money_model_lic_start, | |
ans['businessmodel_license_sales_confirm_no_what']), | |
value_h(:money_model_lic_start_date, | |
ans['businessmodel_license_sales_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
when /Другая/i | |
[ value_h(:money_model_other_desc, answer['businessmodel_other_description']), | |
value_h(:money_model_other_payer, answer['businessmodel_other_who']), | |
options_h(:money_model_other_tested, ->{ | |
radio_a(:money_model_other_tested, [true, false], ->{ | |
case answer['businessmodel_other_confirm'][0] | |
when 'Да' then true | |
when 'Нет' then false | |
end | |
}) do |answ| | |
ans = answer['businessmodel_other_confirm'][1] | |
case answ | |
when true | |
value_h(:money_model_other_income, | |
ans['businessmodel_other_confirm_yes_results']) | |
when false | |
[ value_h(:money_model_other_start, | |
ans['businessmodel_other_confirm_no_what']), | |
value_h(:money_model_other_start_date, | |
ans['businessmodel_other_confirm_no_when']) ] | |
end | |
end | |
}) | |
] | |
#else | |
#raise Getter::ValueError, answer[0] | |
end | |
end | |
} # money_model | |
# Рынок | |
value(:market_mentors, nil) | |
repeated( -> (i){ | |
answer_ver(:market_segment, 1=>[4, 2],2=>[4,2],3=>[4,3])[i.to_s] | |
}) do |answer| | |
[ | |
value_h(:market_segment_name, answer['market_segment_description']), | |
value_h(:market_segment_volume, answer['market_segment_users']), | |
options_h(:market_segment_volume_chb, ->{ | |
return unless answer['market_segment_users_confirmation'] | |
radio_a(:market_segment_volume_chb, ['Гипотеза','Подтверждено исследованием'], | |
answer['market_segment_users_confirmation'][0]. | |
sub(/Гипотеза/i, 'Гипотеза'). | |
sub(/Исследованием?/i, 'Подтверждено исследованием') | |
) do |answ| | |
ans = answer['market_segment_users_confirmation'][1] | |
case answ | |
when /Гипотеза/ | |
value_h(:market_segment_volume_proposal, ans['market_segment_users_confirmation_hypothesis_how_come_to_this']) | |
when /Подтверждено исследованием/ | |
[ value_h(:market_segment_volume_link, ans['market_segment_users_confirmation_research_link_to_research']), | |
value_h(:market_segment_volume_link_desc, ans['market_segment_users_confirmation_research_how_come_to_this']) | |
] | |
end | |
end | |
}), | |
value_h(:market_segment_client_pay_cnt, answer['market_segment_arppu']), | |
options_h(:market_segment_client, ->{ | |
radio_inherit_a(:market_segment_client, | |
->(b){ | |
return nil if b[0] =~ /Собственные продажи/i | |
b[0].sub(/Гипотеза/i, 'proposal').sub(/Исследованием?/i, 'investig') | |
}, answer['market_segment_arppu_confirmation']) do |ans| | |
case ans[0] | |
when /Гипотеза/i | |
value_h(:market_segment_client_pay_proposal_how, ans[1]['market_segment_arppu_confirmation_hypothesis_how_come_to_this']) | |
when /Исследованием?/i | |
[ value_h(:market_segment_client_pay_link, ans[1]['market_segment_arppu_confirmation_research_link_to_research']), | |
value_h(:market_segment_client_pay_link_desc, ans[1]['market_segment_arppu_confirmation_research_how_come_to_this']) ] | |
end | |
end | |
}) | |
] | |
end # end repeated market_segment | |
# Масштаб рынка | |
# TAM | |
value(:market_segment_volume_tam, get_answer(4, 4, :market_tam_size)) | |
options(:market_segment_volume_tam_chb, ->{ | |
return [] unless a = get_answer(4, 4, :market_tam_size_confirmation) | |
radio_a(:market_segment_volume_tam_chb, ['Гипотеза','Подтверждено исследованием'], | |
-> { | |
a[0].sub(/Гипотеза/i, 'Гипотеза'). | |
sub(/Исследованием?/i, 'Подтверждено исследованием') | |
}) do |answ| | |
ans = get_answer(4, 4, :market_tam_size_confirmation)[1] | |
case answ | |
when /Гипотеза/ | |
value_h(:market_segment_volume_tam_proposal, ans['market_tam_size_confirmation_hypothesis_how_come_to_this']) | |
when /Подтверждено исследованием/ | |
[ value_h(:market_segment_volume_tam_link, ans['market_tam_size_confirmation_research_link_to_research']), | |
value_h(:market_segment_volume_tam_link_desc, ans['market_tam_size_confirmation_research_how_come_to_this']) | |
] | |
end | |
end | |
}) | |
# SAM | |
sam_value = get_answer(4, 5, :market_sam_size) || begin | |
return unless market = answer_ver(:market_segment, 3=>[4,3]) | |
sam = 0 | |
market.each do |i, segment| | |
sam += 12 * segment["market_segment_users"].to_i * segment["market_segment_arppu"].gsub(",", ".").to_f | |
end | |
sam = (sam / 1000000) | |
end | |
value(:market_segment_volume_sam, sam_value) | |
options(:market_segment_volume_sam_chb, ->{ | |
return [] unless a = get_answer(4, 5, :market_sam_size_confirmation) | |
radio_a(:market_segment_volume_sam_chb, ['Гипотеза','Подтверждено исследованием'], | |
-> { | |
a[0].sub(/Гипотеза/i, 'Гипотеза'). | |
sub(/Исследованием?/i, 'Подтверждено исследованием') | |
} | |
) do |answ| | |
ans = get_answer(4, 5, :market_sam_size_confirmation)[1] | |
case answ | |
when /Гипотеза/ | |
value_h(:market_segment_volume_sam_proposal, ans['market_sam_size_confirmation_hypothesis_how_come_to_this']) | |
when /Подтверждено исследованием/ | |
[ value_h(:market_segment_volume_sam_link, ans['market_sam_size_confirmation_research_link_to_research']), | |
value_h(:market_segment_volume_sam_link_desc, ans['market_sam_size_confirmation_research_how_come_to_this']) | |
] | |
end | |
end | |
}) | |
# SOM | |
som_value = get_answer(4, 6, :market_som_size) || begin | |
return unless som_str = answer_ver(:market_som_size, 3=>[4,4]) | |
(sam_value * som_str.gsub(/%/, '').to_i)/100 | |
end | |
value(:market_segment_volume_som, som_value) | |
options(:market_segment_volume_som_chb, ->{ | |
return [] unless a = get_answer(4, 6, :market_som_confirmation) | |
radio_a(:market_segment_volume_som_chb, ['Гипотеза','Подтверждено исследованием'], | |
-> { | |
a[0].sub(/Гипотеза/i, 'Гипотеза'). | |
sub(/Исследованием?/i, 'Подтверждено исследованием') | |
}) do |answ| | |
ans = get_answer(4, 6, :market_som_confirmation)[1] | |
case answ | |
when /Гипотеза/ | |
value_h(:market_segment_volume_som_proposal, ans['market_som_confirmation_hypothesis_how_come_to_this']) | |
when /Подтверждено исследованием/ | |
[ value_h(:market_segment_volume_som_link, ans['market_som_confirmation_research_link_to_research']), | |
value_h(:market_segment_volume_som_link_desc, ans['market_som_confirmation_research_how_come_to_this']) | |
] | |
end | |
end | |
}) | |
# География | |
value(:market_geo_current, get_answer(4,7, :market_geography_som)) | |
value(:market_geo_target, get_answer(4,7, :market_geography_sam)) | |
value(:market_geo_future, get_answer(4,7, :market_geography_tam)) | |
value(:market_scale_plan, get_answer(4,5, :market_scale) ) | |
value(:market_scale_res, get_answer(4,5, :market_scale) ) | |
# Партнеры | |
partners_fallback = { '0' => {} } | |
repeated( -> (i){ | |
(get_answer(4, 9, :market_partners) || partners_fallback)[i.to_s] | |
}) do |answer| | |
[ value_h(:market_partner_name, answer['market_partners_name']), | |
value_h(:market_partner_collab, answer['market_partners_why']), | |
value_h(:market_partner_stage, answer['market_partners_status']), | |
value_h(:market_partner_cond, answer['market_partners_terms']) ] | |
end | |
# Конкуренты | |
repeated( -> (i){ | |
get_answer(3, 2, :direct_competitor)[i.to_s] | |
}) do |answer| | |
[ value_h(:conc_dir_name, answer['direct_competitor_name']), | |
value_h(:conc_dir_power, answer['direct_competitor_strong_sides']), | |
value_h(:conc_dir_poor, answer['direct_competitor_weak_sides']), | |
value_h(:conc_dir_avd, answer['direct_competitor_advantage']) ] | |
end | |
repeated( -> (i){ | |
get_answer(3, 3, :indirect_competitor)[i.to_s] | |
}) do |answer| | |
[ value_h(:conc_indir_name, answer['indirect_competitor_name']), | |
value_h(:conc_indir_power, answer['indirect_competitor_strong_sides']), | |
value_h(:conc_indir_poor, answer['indirect_competitor_weak_sides']), | |
value_h(:conc_indir_avd, answer['indirect_competitor_advantage']) ] | |
end | |
# Каналы продвижения/привлечения | |
repeated( -> (i){ | |
answer_ver(:channel, 1=>[5,3],2=>[5,3],3=>[5,2])[i.to_s] | |
}) do |answer| | |
[ value_h(:channel_name, answer['channel_name']), | |
value_h(:channel_cli_cost, answer['channel_cost']), | |
value_h(:channel_cli_count, answer['channel_size']), | |
value_h(:channel_cli_conversion, nil) ] | |
end | |
# Инвестиционная информация | |
# В анкете это не спрашивалось | |
options :invest, -> { | |
radio_inherit_a :invest, ->(b){ | |
#return unless b | |
#b.sub('Да', 'yes').sub('Нет','no') | |
}, nil do |ans| | |
#case ans | |
#when 'Да' | |
#[ value_h(:product_unique_owner, nil), | |
#value_h(:product_unique_idea, nil) ] | |
#end | |
end | |
} | |
value(:invest_required_amount, nil) | |
options :invest_for, -> { | |
radio_inherit_a :invest_for, ->(b){ | |
#return unless b | |
#b.sub('Да', 'yes').sub('Нет','no') | |
}, nil do |ans| | |
#case ans | |
#when 'Да' | |
#[ value_h(:product_unique_owner, nil), | |
#value_h(:product_unique_idea, nil) ] | |
#end | |
end | |
} | |
value(:invest_required_option, nil) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Questionary | |
class Small < Serializer | |
def values | |
# Общая информация | |
value :project_name, -> { object.title } | |
value :project_site, -> { object.link } | |
value :project_source, -> { } # ADD | |
value :project_askcap, -> { } # integer | |
file :project_presentation, -> { } # ADD | |
options :project_movie, -> { [] } | |
# Команда | |
value :team_members, -> {{ | |
1 => get_answer(1, 1, :members_count), | |
2 => get_answer(1, 1, :members_count), | |
3 => (get_answer(1, 5, :member).keys.count + 1 rescue nil) | |
}} | |
value :team_members_persistent, -> {{ | |
1 => get_answer(1, 1, :working_count), | |
2 => get_answer(1, 1, :working_count), | |
3 => (get_answer(1, 5, :member).keys.count + 1 rescue nil) # TODO посчитать 'на постоянной основе' | |
}} | |
# Руководитель проекта | |
file :manager_cv, -> {{ | |
1 => get_file(1, 10, :'prikrepite-rezume-ru'), | |
2 => get_file(1, 10, :'prikrepite-rezume-ru') | |
}} | |
value :manager_surname, -> { get_answer(1, 2, :surname) } | |
value :manager_name, -> { get_answer(1, 2, :name) } | |
value :manager_patronymic, -> { get_answer(1, 2, :patronymic) } | |
radio :manager_citizenship, %w(РФ Иное), -> { get_answer(1, 2, :citizenship).first } | |
radio :manager_tax_residency, %w(РФ Иное), -> { get_answer(1, 2, :tax_resident).first } | |
value :manager_percent_part, -> { get_answer(1, 2, :share) } | |
value :manager_phone, -> { user.phone } | |
value :manager_skype, -> { user.skype } | |
value :manager_email, -> { user.email } | |
options :manager_another_project, -> { | |
checkbox_a :manager_another_project, { | |
/Не задействован/i => :no, | |
/Задействован/i => :yes | |
}, -> {{ | |
1 => ['Не задействован'], | |
2 => ['Не задействован'], | |
3 => get_answer(1, 2, :employment) | |
}} do |val| | |
case val | |
when :no | |
radio_a :manager_another_project_no_involvement, ['Полная', 'Частичная', nil], -> {{ | |
1 => get_answer(1, 2, :employment).first, | |
2 => get_answer(1, 2, :employment).first, | |
3 => (get_answer(1, 2, :employment)[1]["stepen-vovlechennost"][0] rescue nil) | |
}} | |
when :yes | |
[ | |
value_h(:manager_another_project_company, -> { get_answer(1, 2, :employment)[1]["other_project"]["0"]["project_name"] rescue nil}), | |
value_h(:manager_another_project_branch, -> { get_answer(1, 2, :employment)[1]["other_project"]["0"]["industry"] rescue nil}), | |
value_h(:manager_another_project_role, -> { get_answer(1, 2, :employment)[1]["other_project"]["0"]["position"] rescue nil}), | |
value_h(:manager_another_project_positive_involvement, -> { get_answer(1, 2, :employment)[1]["other_project"]["0"]["involvement"] rescue nil}) | |
] | |
else | |
ArgumentError.new "#{val.inspect} is impermissible. " | |
end | |
end | |
} | |
value :manager_role, -> { 'Руководитель проекта' } | |
# Бизнес-опыт руководителя | |
value :manager_reason, -> {{ | |
1 => get_answer(1, 6, :why_it), | |
2 => get_answer(1, 6, :why_it), | |
3 => get_answer(1, 3, :why_it) | |
}} | |
value :manager_unique_experience, -> {{ | |
1 => get_answer(1, 5, :unique_experience), | |
2 => get_answer(1, 5, :unique_experience), | |
3 => get_answer(1, 3, :uniq_experience) | |
}} | |
value :manager_money_invested, -> {{ | |
1 => get_answer(1, 6, :"money invested"), | |
2 => get_answer(1, 6, :"money invested"), | |
3 => get_answer(1, 3, :money_invested) | |
}} | |
value :manager_time_worked_on_project, -> {{ | |
1 => get_answer(1, 6, :how_long_do_this), | |
2 => get_answer(1, 6, :how_long_do_this), | |
3 => get_answer(1, 3, :how_long_do_this) | |
}} | |
options(:manager_other_startup, -> { | |
begin | |
radio_a :manager_other_startup, [true, false], -> {{ | |
1 => nil, | |
2 => nil, | |
3 => (get_answer(1, 3, :experience, {"Да"=>true,"Нет"=>false}) do |v| v.first end rescue nil) | |
}} do |val| | |
case val | |
when false then nil | |
when true | |
[ | |
value_h(:manager_experience_company_name, -> {{ 3 => get_answer(1, 3, :experience)[1]["company_name"] }}), | |
value_h(:manager_experience_company_site, -> {{ 3 => get_answer(1, 3, :experience)[1]["web_site"] }}), | |
value_h(:manager_experience_company_role, -> {{ 3 => get_answer(1, 3, :experience)[1]["role"] }}), | |
value_h(:manager_experience_company_sphere, -> {{ 3 => get_answer(1, 3, :experience)[1]["sphere"] }}), | |
value_h(:manager_experience_company_state, -> {{ 3 => get_answer(1, 3, :experience)[1]["state"] }}) | |
] | |
end | |
end | |
rescue ValueError | |
[] | |
end | |
}) | |
# Участники команды | |
repeated( -> (i){ | |
case user.version | |
when 1,2 then get_answer(1,9, :member)[i.to_s] | |
when 3 then get_answer(1,5, :member)[i.to_s] | |
end | |
}) do |ans| | |
[ | |
value_h(:team_member_surname, -> { ans["member_surname"] rescue nil}), | |
value_h(:team_member_name, -> { ans["member_name"] rescue nil}), | |
value_h(:team_member_patronymic, -> { ans["member_patronymic"] rescue nil}), | |
file_h(:team_member_cv, -> { nil }), | |
*radio_a(:team_member_citizenship, %w(РФ Иное), -> { ans["member_citizenship"].first rescue nil}), | |
*radio_a(:team_member_tax_residency, %w(РФ Иное), -> { ans["member_tax_resident"].first rescue nil}), | |
value_h(:team_member_percent_part, -> { ans["member_share"] }), | |
options_h(:team_member_involved, -> { | |
checkbox_a(:team_member_involved, { | |
/Не задействован/i => :no, | |
/Задействован/i => :yes | |
}, -> { | |
case ans["member_employment"].first | |
when 'Задействован' | |
['Задействован'] | |
when 'Полная', 'Частичная' # ver 1,2 | |
['Не задействован'] | |
when 'Не задействован' # ver 3 | |
['Не задействован'] | |
end | |
}) do |val| | |
case val | |
when :no | |
radio_a(:team_member_current_project_involved, ['Полная','Частичная', nil], -> {{ | |
1 => ans["member_employment"][0], | |
2 => ans["member_employment"][0], | |
3 => (ans["member_employment"][1]["stepen-vovlechennost"][0] rescue nil) | |
}}) | |
when :yes | |
[ | |
value_h(:team_member_involved_company, -> { ans["member_employment"][1]["other_project"]["0"]["project_name"] rescue nil}), | |
value_h(:team_member_involved_branch, -> { ans["member_employment"][1]["other_project"]["0"]["industry"] rescue nil}), | |
value_h(:team_member_involved_role, -> { ans["member_employment"][1]["other_project"]["0"]["position"] rescue nil}), | |
value_h(:team_member_involved_level, -> { ans["member_employment"][1]["other_project"]["0"]["involvement"] rescue nil}), | |
] | |
else | |
ArgumentError.new "#{val.inspect} is impermissible. " | |
end | |
end | |
}), | |
value_h(:team_member_phone, -> { nil }), | |
value_h(:team_member_role, -> { ans["member_role"] }) | |
] | |
end | |
# Продукт | |
value :product_description, -> {{ | |
1 => get_answer(0, 1, :description), | |
2 => get_answer(0, 0, :description), | |
3 => get_answer(0, 0, :description), | |
}} | |
options :solution, -> { | |
checkbox_a :solution, { | |
/cloud/i => :cloud, | |
/mobile/i => :mobile, | |
/web/i => :web, | |
/Другое/i => :other | |
}, -> {{ | |
1 => (get_answer(0, 2, :implementation) rescue nil), | |
2 => (get_answer(2, 1, :implementation) rescue nil), | |
3 => (get_answer(2, 1, :implementation) rescue nil) | |
}} | |
} | |
options :sector, -> { | |
checkbox_a :sector, nil, -> {{ | |
1 => (get_answer(0, 2, :sector) rescue nil), | |
2 => (get_answer(2, 1, :sector) rescue nil), | |
3 => (get_answer(2, 1, :sector) rescue nil) | |
}} | |
} | |
options :product_area, -> { | |
checkbox_a :product_area, { | |
/e-commerce|Справочные/i => :ecommerce, | |
/Социальные/i => :socnet, | |
/Медиа/i => :media, | |
/Игры/i => :games, | |
/Финансы/i => :finance, | |
/Туризм/i => :tourism, | |
/Реклама/i => :advertisement, | |
/Видео-аудио/i => :videoaudio, | |
/Образование/i => :education, | |
/Медицина/i => :medicine, | |
/Безопасность/i => :protection, | |
/e-government/i => :egovernment, | |
/Business|Среда\sразработки/i => :business, | |
/Crowd/i => :crowd, | |
/Интернет вещей/i => :iot, | |
/коммуникац/ => :communication, | |
/Big Data/i => :bigdata | |
}, -> {{ | |
1 => get_answer(0, 2, :sphere), | |
2 => get_answer(0, 0, :sphere), | |
3 => get_answer(0, 0, :sphere) | |
}} | |
} | |
value :product_solution, -> { get_answer(2, 1, :what_business) } | |
value :product_solution_user, -> { get_answer(2, 2, :who_consumer) } | |
value :product_solution_current, -> { get_answer(2, 2, :what_now) } | |
value :product_solution_bait, -> { get_answer(2, 3, :why_buy) } | |
options :product_stage, -> { | |
checkbox_a :product_stage, { | |
/Идея/i => :idea, | |
/разрабатывается/i => :mvp_not_ready, | |
/готов/i => :mvp_ready | |
}, -> {{ | |
1 => (get_answer(2, 5, :product_stage) rescue nil), | |
2 => (get_answer(2, 5, :product_stage) rescue nil), | |
3 => (get_answer(2, 3, :product_stage) rescue nil) | |
}} do |val| | |
case val | |
when :mvp_not_ready # 'MVP разрабатывается', 'Нет, MVP еще разрабатывается' | |
[ | |
file_h(:product_stage_mvp_not_ready_screenshot, -> {{ | |
1 => get_file(2, 5, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}), | |
2 => get_file(2, 5, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}), | |
3 => get_file(2, 3, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}) | |
}}), | |
value_h(:product_stage_mvp_not_ready_done, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_what_done"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_what_done"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_making_what_done"] rescue nil) | |
}}), | |
value_h(:product_stage_mvp_not_ready_todo, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_what_need_make"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_what_need_make"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_making_what_need_make"] rescue nil) | |
}}), | |
value_h(:product_stage_mvp_not_ready_impact, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_why_need"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_making_why_need"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_making_why_need"] rescue nil) | |
}}), | |
] | |
when :mvp_ready # 'MVP готов', 'Да, MVP готов к тестированию бизнес-модели и первым продажам' | |
[ | |
file_h(:product_stage_mvp_ready_screenshot, -> {{ | |
1 => get_file(2, 5, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}), | |
2 => get_file(2, 5, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}), | |
3 => get_file(2, 3, :product_stage, ->(obj){obj[1]["copy_time"] rescue nil}) | |
}}), | |
value_h(:product_stage_mvp_ready_done, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_what_done"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_what_done"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_done_what_done"] rescue nil) | |
}}), | |
value_h(:product_stage_mvp_ready_todo, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_what_need_make"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_what_need_make"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_done_what_need_make"] rescue nil) | |
}}), | |
value_h(:product_stage_mvp_ready_impact, -> {{ | |
1 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_why_need"] rescue nil), | |
2 => (get_answer(2, 5, :product_stage)[1]["product_stage_done_why_need"] rescue nil), | |
3 => (get_answer(2, 3, :product_stage)[1]["product_stage_done_why_need"] rescue nil) | |
}}), | |
] | |
end | |
end | |
} | |
# Финансовая информация | |
value :finance_monthly_cost, -> {{ | |
1 => get_answer(6, 5, :costs_month), | |
2 => get_answer(6, 5, :costs_month), | |
3 => get_answer(6, 4, :costs_month) | |
}} | |
value :finance_cost_breakdown, -> {{ | |
1 => get_answer(6, 5, :costs_structure), | |
2 => get_answer(6, 5, :costs_structure), | |
3 => get_answer(6, 4, :costs_structure) | |
}} | |
value :finance_time_remains, -> {{ | |
1 => get_answer(6, 5, :costs_without), | |
2 => get_answer(6, 5, :costs_without), | |
3 => get_answer(6, 4, :costs_without) | |
}} | |
value :finance_monthly_income, -> {{ | |
1 => get_answer(6, 4, :revenue_month), | |
2 => get_answer(6, 4, :revenue_month), | |
3 => get_answer(6, 3, :revenue_month) | |
}} | |
value :finance_total_income, -> {{ | |
1 => get_answer(6, 4, :revenue_overall), | |
2 => get_answer(6, 4, :revenue_overall), | |
3 => get_answer(6, 3, :revenue_overall) | |
}} | |
value :finance_how, -> {{ | |
1 => get_answer(6, 5, :costs_funding), | |
2 => get_answer(6, 5, :costs_funding), | |
3 => get_answer(6, 4, :costs_funding) | |
}} | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment