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

アンケート回答の選択肢を追加 #1182

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Covid19Radar/Covid19Radar/Model/SurveyContent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace Covid19Radar.Model
public class SurveyContent
{
[JsonProperty("q1")]
public int Q1 { get; set; }
public int? Q1 { get; set; }

[JsonProperty("q2")]
public int Q2 { get; set; }
public int? Q2 { get; set; }

[JsonProperty("start_date")]
public long? StartDate { get; set; }
Expand Down
74 changes: 73 additions & 1 deletion Covid19Radar/Covid19Radar/Resources/AppResources.Designer.cs

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

52 changes: 42 additions & 10 deletions Covid19Radar/Covid19Radar/Resources/AppResources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1699,25 +1699,57 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>選択してください</value>
<comment>選択してください</comment>
</data>
<data name="SurveyPageNotAnswer" xml:space="preserve">
<value>回答しない</value>
<comment>回答しない</comment>
</data>
<data name="SurveyPageQ1A1" xml:space="preserve">
<value>〜9歳</value>
<comment>〜9歳</comment>
<value>14歳以下</value>
<comment>14歳以下</comment>
</data>
<data name="SurveyPageQ1A2" xml:space="preserve">
<value>10歳〜19歳</value>
<comment>10歳〜19歳</comment>
<value>15-19歳</value>
<comment>15-19歳</comment>
</data>
<data name="SurveyPageQ1A3" xml:space="preserve">
<value>20歳〜29歳</value>
<comment>20歳〜29歳</comment>
<value>20-24歳</value>
<comment>20-24歳</comment>
</data>
<data name="SurveyPageQ1A4" xml:space="preserve">
<value>25-29歳</value>
<comment>25-29歳</comment>
</data>
<data name="SurveyPageQ1A5" xml:space="preserve">
<value>30-39歳</value>
<comment>30-39歳</comment>
</data>
<data name="SurveyPageQ1A6" xml:space="preserve">
<value>40-49歳</value>
<comment>40-49歳</comment>
</data>
<data name="SurveyPageQ1A7" xml:space="preserve">
<value>50-59歳</value>
<comment>50-59歳</comment>
</data>
<data name="SurveyPageQ1A8" xml:space="preserve">
<value>60-69歳</value>
<comment>60-69歳</comment>
</data>
<data name="SurveyPageQ1A9" xml:space="preserve">
<value>70歳以上</value>
<comment>70歳以上</comment>
</data>
<data name="SurveyPageQ2A1" xml:space="preserve">
<value>有り</value>
<comment>有り</comment>
<value>通勤・通学をしていない</value>
<comment>通勤・通学をしていない</comment>
</data>
<data name="SurveyPageQ2A2" xml:space="preserve">
<value>無し</value>
<comment>無し</comment>
<value>公共交通機関以外のみで通勤通学</value>
<comment>公共交通機関以外のみで通勤通学</comment>
</data>
<data name="SurveyPageQ2A3" xml:space="preserve">
<value>公共交通機関を利用して通勤通学</value>
<comment>公共交通機関を利用して通勤通学</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>回答を確定した後、利用を終了することで回答が送信されます。
Expand Down
44 changes: 38 additions & 6 deletions Covid19Radar/Covid19Radar/Resources/AppResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1801,25 +1801,57 @@ By collecting the number of notifications, we can use it to understand how many
<value>TODO</value>
<comment>選択してください</comment>
</data>
<data name="SurveyPageNotAnswer" xml:space="preserve">
<value>TODO</value>
<comment>回答しない</comment>
</data>
<data name="SurveyPageQ1A1" xml:space="preserve">
<value>TODO</value>
<comment>〜9歳</comment>
<comment>14歳以下</comment>
</data>
<data name="SurveyPageQ1A2" xml:space="preserve">
<value>TODO</value>
<comment>10歳〜19歳</comment>
<comment>15-19歳</comment>
</data>
<data name="SurveyPageQ1A3" xml:space="preserve">
<value>TODO</value>
<comment>20歳〜29歳</comment>
<comment>20-24歳</comment>
</data>
<data name="SurveyPageQ1A4" xml:space="preserve">
<value>TODO</value>
<comment>25-29歳</comment>
</data>
<data name="SurveyPageQ1A5" xml:space="preserve">
<value>TODO</value>
<comment>30-39歳</comment>
</data>
<data name="SurveyPageQ1A6" xml:space="preserve">
<value>TODO</value>
<comment>40-49歳</comment>
</data>
<data name="SurveyPageQ1A7" xml:space="preserve">
<value>TODO</value>
<comment>50-59歳</comment>
</data>
<data name="SurveyPageQ1A8" xml:space="preserve">
<value>TODO</value>
<comment>60-69歳</comment>
</data>
<data name="SurveyPageQ1A9" xml:space="preserve">
<value>TODO</value>
<comment>70歳以上</comment>
</data>
<data name="SurveyPageQ2A1" xml:space="preserve">
<value>有り</value>
<comment>有り</comment>
<value>TODO</value>
<comment>通勤・通学をしていない</comment>
</data>
<data name="SurveyPageQ2A2" xml:space="preserve">
<value>TODO</value>
<comment>無し</comment>
<comment>公共交通機関以外のみで通勤通学</comment>
</data>
<data name="SurveyPageQ2A3" xml:space="preserve">
<value>TODO</value>
<comment>公共交通機関を利用して通勤通学</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>TODO</value>
Expand Down
44 changes: 38 additions & 6 deletions Covid19Radar/Covid19Radar/Resources/AppResources.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1701,25 +1701,57 @@ COCOAのソースコードは次のURLから入手できます。</comment>
<value>TODO</value>
<comment>選択してください</comment>
</data>
<data name="SurveyPageNotAnswer" xml:space="preserve">
<value>TODO</value>
<comment>回答しない</comment>
</data>
<data name="SurveyPageQ1A1" xml:space="preserve">
<value>TODO</value>
<comment>〜9歳</comment>
<comment>14歳以下</comment>
</data>
<data name="SurveyPageQ1A2" xml:space="preserve">
<value>TODO</value>
<comment>10歳〜19歳</comment>
<comment>15-19歳</comment>
</data>
<data name="SurveyPageQ1A3" xml:space="preserve">
<value>TODO</value>
<comment>20歳〜29歳</comment>
<comment>20-24歳</comment>
</data>
<data name="SurveyPageQ1A4" xml:space="preserve">
<value>TODO</value>
<comment>25-29歳</comment>
</data>
<data name="SurveyPageQ1A5" xml:space="preserve">
<value>TODO</value>
<comment>30-39歳</comment>
</data>
<data name="SurveyPageQ1A6" xml:space="preserve">
<value>TODO</value>
<comment>40-49歳</comment>
</data>
<data name="SurveyPageQ1A7" xml:space="preserve">
<value>TODO</value>
<comment>50-59歳</comment>
</data>
<data name="SurveyPageQ1A8" xml:space="preserve">
<value>TODO</value>
<comment>60-69歳</comment>
</data>
<data name="SurveyPageQ1A9" xml:space="preserve">
<value>TODO</value>
<comment>70歳以上</comment>
</data>
<data name="SurveyPageQ2A1" xml:space="preserve">
<value>有り</value>
<comment>有り</comment>
<value>TODO</value>
<comment>通勤・通学をしていない</comment>
</data>
<data name="SurveyPageQ2A2" xml:space="preserve">
<value>TODO</value>
<comment>無し</comment>
<comment>公共交通機関以外のみで通勤通学</comment>
</data>
<data name="SurveyPageQ2A3" xml:space="preserve">
<value>TODO</value>
<comment>公共交通機関を利用して通勤通学</comment>
</data>
<data name="SurveyPageDescription" xml:space="preserve">
<value>TODO</value>
Expand Down
4 changes: 2 additions & 2 deletions Covid19Radar/Covid19Radar/Services/SurveyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public async Task<SurveyContent> BuildSurveyContent(int q1, int q2, bool isAppSt
{
var surveyContent = new SurveyContent
{
Q1 = q1,
Q2 = q2,
Q1 = q1 > 0 ? (int?)q1 : null,
Q2 = q2 > 0 ? (int?)q2 : null,
StartDate = isAppStartDate ? (long?)_userDataRepository.GetStartDate().ToUnixEpoch() : null,
ExposureData = isExposureDataProvision ? await GetExopsureData() : null
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Covid19Radar.Common;
using Covid19Radar.Model;
using Covid19Radar.Repository;
using Covid19Radar.Resources;
using Covid19Radar.Services;
using Covid19Radar.Services.Logs;
using Covid19Radar.Views.EndOfService;
using Prism.Navigation;
using Xamarin.CommunityToolkit.ObjectModel;
Expand Down Expand Up @@ -83,7 +80,7 @@ public bool IsExposureDataProvision
}

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

private readonly IUserDataRepository _userDataRepository;
private readonly ISurveyService _surveyService;
Expand Down
10 changes: 10 additions & 0 deletions Covid19Radar/Covid19Radar/Views/EndOfService/SurveyPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPagePleaseSelect}" Value="0" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A1}" Value="1" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A2}" Value="2" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A3}" Value="3" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A4}" Value="4" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A5}" Value="5" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A6}" Value="6" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A7}" Value="7" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A8}" Value="8" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ1A9}" Value="9" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageNotAnswer}" Value="-1" />
</x:Array>
</Picker.ItemsSource>
</Picker>
Expand All @@ -60,6 +68,8 @@
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPagePleaseSelect}" Value="0" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ2A1}" Value="1" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ2A2}" Value="2" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageQ2A3}" Value="3" />
<models:SurveyAnswerPickerItem Text="{x:Static resources:AppResources.SurveyPageNotAnswer}" Value="-1" />
</x:Array>
</Picker.ItemsSource>
</Picker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ public async Task BuildSurveyContentTests_HasStartDate_HasExposureDataProvision(
public async Task BuildSurveyContentTests_HasNotStartDate_HasNotExposureDataProvision()
{
SurveyService unitUnderTest = CreateService();
SurveyContent result = await unitUnderTest.BuildSurveyContent(1, 2, false, false);
SurveyContent result = await unitUnderTest.BuildSurveyContent(-1, -1, false, false);

_testOutputHelper.WriteLine($"TimeZoneInfo.Local: {TimeZoneInfo.Local}");

Assert.Equal(1, result.Q1);
Assert.Equal(2, result.Q2);
Assert.Null(result.Q1);
Assert.Null(result.Q2);
Assert.Null(result.StartDate);
Assert.Null(result.ExposureData);

Expand Down