Skip to content
This repository has been archived by the owner on Apr 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1173 from cocoa-mhlw/feature/survey-page
Browse files Browse the repository at this point in the history
利用調査画面のデザインと送信内容の修正
  • Loading branch information
cocoa-dev003 authored Oct 17, 2022
2 parents 29fbf88 + 380a282 commit adfc824
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 101 deletions.
4 changes: 2 additions & 2 deletions Covid19Radar/Covid19Radar/Model/SurveyContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public class SurveyContent
[JsonProperty("q2")]
public int Q2 { get; set; }

[JsonProperty("q3")]
public long Q3 { get; set; }
[JsonProperty("start_date")]
public long? StartDate { get; set; }

[JsonProperty("exposure_data")]
public SurveyExposureData ExposureData { get; set; }
Expand Down
35 changes: 31 additions & 4 deletions Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 28 additions & 15 deletions Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1660,32 +1660,40 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<comment>利用調査</comment>
</data>
<data name="SurveyPageQuestionnaire" xml:space="preserve">
<value>アンケート</value>
<comment>アンケート</comment>
<value>利用者に関するアンケート</value>
<comment>利用者に関するアンケート</comment>
</data>
<data name="SurveyPageQ1Text" xml:space="preserve">
<value>Q1:年代</value>
<comment>Q1:年代</comment>
</data>
<data name="SurveyPageQ2Text" xml:space="preserve">
<value>Q2:日常的な通勤通学の有無</value>
<comment>Q2:日常的な通勤通学の有無</comment>
<value>Q2:週に1回以上の通勤通学の有無</value>
<comment>Q2:週に1回以上の通勤通学の有無</comment>
</data>
<data name="SurveyPageQuestion3" xml:space="preserve">
<value>Q3:アプリ利用開始日</value>
<comment>Q3:アプリ利用開始日</comment>
<data name="SurveyPageQ2Description" xml:space="preserve">
<value>(公共交通機関とは、鉄道・電車・乗り合いバスのことです)</value>
<comment>(公共交通機関とは、鉄道・電車・乗り合いバスのことです)</comment>
</data>
<data name="SurveyPageExposureDataProvisionTitle" xml:space="preserve">
<value>接触情報提供のお願い</value>
<comment>接触情報提供のお願い</comment>
<value>接触通知発生回数の調査</value>
<comment>接触通知発生回数の調査</comment>
</data>
<data name="SurveyPageExposureDataProvisionDescription" xml:space="preserve">
<value>保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</value>
<comment>保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
<value>2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</value>
<comment>2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
</data>
<data name="SurveyPageAppStartDateSwitch" xml:space="preserve">
<value>アプリ利用開始日</value>
<comment>アプリ利用開始日</comment>
</data>
<data name="SurveyPageAppStartDateText" xml:space="preserve">
<value>({0})</value>
<comment>({0})</comment>
</data>
<data name="SurveyPageExposureDataProvisionSwitch" xml:space="preserve">
<value>接触情報の提供</value>
<comment>接触情報の提供</comment>
<value>接触通知発生回数</value>
<comment>接触通知発生回数</comment>
</data>
<data name="SurveyPagePleaseSelect" xml:space="preserve">
<value>選択してください</value>
Expand All @@ -1711,8 +1719,13 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>無し</value>
<comment>無し</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>回答を確定した後、利用を終了することで回答が送信されます。
一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。</value>
<comment>回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。</comment>
</data>
<data name="SurveyPageToTerminationOfUsePageButton" xml:space="preserve">
<value>利用終了の確認へ</value>
<comment>利用終了の確認へ</comment>
<value>回答を確定する</value>
<comment>回答を確定する</comment>
</data>
</root>
28 changes: 20 additions & 8 deletions Covid19Radar/Covid19Radar/Resources/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1763,31 +1763,39 @@ By collecting the number of notifications, we can use it to understand how many
</data>
<data name="SurveyPageQuestionnaire" xml:space="preserve">
<value>TODO</value>
<comment>アンケート</comment>
<comment>利用者に関するアンケート</comment>
</data>
<data name="SurveyPageQ1Text" xml:space="preserve">
<value>TODO</value>
<comment>Q1:年代</comment>
</data>
<data name="SurveyPageQ2Text" xml:space="preserve">
<value>TODO</value>
<comment>Q2:日常的な通勤通学の有無</comment>
<comment>Q2:週に1回以上の通勤通学の有無</comment>
</data>
<data name="SurveyPageQuestion3" xml:space="preserve">
<data name="SurveyPageQ2Description" xml:space="preserve">
<value>TODO</value>
<comment>Q3:アプリ利用開始日</comment>
<comment>(公共交通機関とは、鉄道・電車・乗り合いバスのことです)</comment>
</data>
<data name="SurveyPageExposureDataProvisionTitle" xml:space="preserve">
<value>TODO</value>
<comment>接触情報提供のお願い</comment>
<comment>接触通知発生回数の調査</comment>
</data>
<data name="SurveyPageExposureDataProvisionDescription" xml:space="preserve">
<value>TODO</value>
<comment>保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
<comment>2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
</data>
<data name="SurveyPageAppStartDateSwitch" xml:space="preserve">
<value>TODO</value>
<comment>アプリ利用開始日</comment>
</data>
<data name="SurveyPageAppStartDateText" xml:space="preserve">
<value>TODO</value>
<comment>({0})</comment>
</data>
<data name="SurveyPageExposureDataProvisionSwitch" xml:space="preserve">
<value>TODO</value>
<comment>接触情報の提供</comment>
<comment>接触通知発生回数</comment>
</data>
<data name="SurveyPagePleaseSelect" xml:space="preserve">
<value>TODO</value>
Expand All @@ -1813,8 +1821,12 @@ By collecting the number of notifications, we can use it to understand how many
<value>TODO</value>
<comment>無し</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>TODO</value>
<comment>回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。</comment>
</data>
<data name="SurveyPageToTerminationOfUsePageButton" xml:space="preserve">
<value>TODO</value>
<comment>利用終了の確認へ</comment>
<comment>回答を確定する</comment>
</data>
</root>
28 changes: 20 additions & 8 deletions Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1660,31 +1660,39 @@ COCOAのソースコードは次のURLから入手できます。</comment>
</data>
<data name="SurveyPageQuestionnaire" xml:space="preserve">
<value>TODO</value>
<comment>アンケート</comment>
<comment>利用者に関するアンケート</comment>
</data>
<data name="SurveyPageQ1Text" xml:space="preserve">
<value>TODO</value>
<comment>Q1:年代</comment>
</data>
<data name="SurveyPageQ2Text" xml:space="preserve">
<value>TODO</value>
<comment>Q2:日常的な通勤通学の有無</comment>
<comment>Q2:週に1回以上の通勤通学の有無</comment>
</data>
<data name="SurveyPageQuestion3" xml:space="preserve">
<data name="SurveyPageQ2Description" xml:space="preserve">
<value>TODO</value>
<comment>Q3:アプリ利用開始日</comment>
<comment>(公共交通機関とは、鉄道・電車・乗り合いバスのことです)</comment>
</data>
<data name="SurveyPageExposureDataProvisionTitle" xml:space="preserve">
<value>TODO</value>
<comment>接触情報提供のお願い</comment>
<comment>接触通知発生回数の調査</comment>
</data>
<data name="SurveyPageExposureDataProvisionDescription" xml:space="preserve">
<value>TODO</value>
<comment>保存している接触情報を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
<comment>2022年4月7日以降の接触通知発生回数(個人情報は含まれません)を添付してよろしいですか。送信を許可する場合はチェックを入れてください。</comment>
</data>
<data name="SurveyPageAppStartDateSwitch" xml:space="preserve">
<value>TODO</value>
<comment>アプリ利用開始日</comment>
</data>
<data name="SurveyPageAppStartDateText" xml:space="preserve">
<value>TODO</value>
<comment>({0})</comment>
</data>
<data name="SurveyPageExposureDataProvisionSwitch" xml:space="preserve">
<value>TODO</value>
<comment>接触情報の提供</comment>
<comment>接触通知発生回数</comment>
</data>
<data name="SurveyPagePleaseSelect" xml:space="preserve">
<value>TODO</value>
Expand All @@ -1710,8 +1718,12 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>TODO</value>
<comment>無し</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>TODO</value>
<comment>回答を確定した後、利用を終了することで回答が送信されます。一度送信された調査への回答の訂正・取り消しはできませんので、ご注意ください。</comment>
</data>
<data name="SurveyPageToTerminationOfUsePageButton" xml:space="preserve">
<value>TODO</value>
<comment>利用終了の確認へ</comment>
<comment>回答を確定する</comment>
</data>
</root>
11 changes: 7 additions & 4 deletions Covid19Radar/Covid19Radar/Services/SurveyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,34 @@ namespace Covid19Radar.Services
{
public interface ISurveyService
{
Task<SurveyContent> BuildSurveyContent(int q1, int q2, DateTime q3, bool isExposureDataProvision);
Task<SurveyContent> BuildSurveyContent(int q1, int q2, bool isAppStartDate, bool isExposureDataProvision);
Task<bool> SubmitSurvey(SurveyContent surveyContent);
}

public class SurveyService : ISurveyService
{
private readonly IEventLogService _eventLogService;
private readonly IExposureDataRepository _exposureDataRepository;
private readonly IUserDataRepository _userDataRepository;

public SurveyService(
IEventLogService eventLogService,
IExposureDataRepository exposureDataRepository
IExposureDataRepository exposureDataRepository,
IUserDataRepository userDataRepository
)
{
_eventLogService = eventLogService;
_exposureDataRepository = exposureDataRepository;
_userDataRepository = userDataRepository;
}

public async Task<SurveyContent> BuildSurveyContent(int q1, int q2, DateTime q3, bool isExposureDataProvision)
public async Task<SurveyContent> BuildSurveyContent(int q1, int q2, bool isAppStartDate, bool isExposureDataProvision)
{
var surveyContent = new SurveyContent
{
Q1 = q1,
Q2 = q2,
Q3 = q3.ToUnixEpoch(),
StartDate = isAppStartDate ? (long?)_userDataRepository.GetStartDate().ToUnixEpoch() : null,
ExposureData = isExposureDataProvision ? await GetExopsureData() : null
};
return surveyContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Covid19Radar.Common;
using Covid19Radar.Model;
using Covid19Radar.Repository;
using Covid19Radar.Resources;
using Covid19Radar.Services;
using Covid19Radar.Services.Logs;
using Covid19Radar.Views.EndOfService;
Expand All @@ -20,9 +21,6 @@ public class SurveyPageViewModel : ViewModelBase
private void IsTerminationOfUsePageButtonEnabledChanged()
=> OnPropertyChanged(new PropertyChangedEventArgs(nameof(IsTerminationOfUsePageButtonEnabled)));

public DateTime MimimumStartDate
=> AppConstants.COCOA_FIRST_RELEASE_DATE.ToLocalTime();

private int _selectedIndexQ1;
public int SelectedIndexQ1
{
Expand Down Expand Up @@ -63,17 +61,18 @@ public SurveyAnswerPickerItem SelectedItemQ2
set => SetProperty(ref _selectedItemQ2, value);
}

private DateTime _q3Answer;
public DateTime Q3Answer
private string _appStartDateText;
public string AppStartDateText
{
get => _q3Answer;
set
{
if (SetProperty(ref _q3Answer, value))
{
IsTerminationOfUsePageButtonEnabledChanged();
}
}
get => _appStartDateText;
set => SetProperty(ref _appStartDateText, value);
}

private bool _isAppStartDate;
public bool IsAppStartDate
{
get => _isAppStartDate;
set => SetProperty(ref _isAppStartDate, value);
}

private bool _isExposureDataProvision;
Expand All @@ -84,7 +83,7 @@ public bool IsExposureDataProvision
}

public bool IsTerminationOfUsePageButtonEnabled
=> _selectedIndexQ1 > 0 && _selectedIndexQ2 > 0 && _q3Answer != null;
=> _selectedIndexQ1 > 0 && _selectedIndexQ2 > 0;

private readonly IUserDataRepository _userDataRepository;
private readonly ISurveyService _surveyService;
Expand All @@ -108,8 +107,13 @@ public override void Initialize(INavigationParameters parameters)
SelectedIndexQ2 = 0;

DateTime startDate = _userDataRepository.GetStartDate();
Q3Answer = startDate.ToLocalTime();

AppStartDateText = string.Format(
AppResources.SurveyPageAppStartDateText,
startDate.ToLocalTime().ToString("yyyy年MM月dd日")
);

IsAppStartDate = false;
IsExposureDataProvision = false;
}

Expand All @@ -118,7 +122,7 @@ public override void Initialize(INavigationParameters parameters)
SurveyContent surveyContent = await _surveyService.BuildSurveyContent(
SelectedItemQ1.Value,
SelectedItemQ2.Value,
Q3Answer,
IsAppStartDate,
IsExposureDataProvision);
var navigationParameters = TerminationOfUsePage.BuildNavigationParams(surveyContent);
Expand Down
Loading

0 comments on commit adfc824

Please sign in to comment.