Skip to content

Commit

Permalink
Rename to U.S. vs China.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramirisu committed Jan 29, 2024
1 parent e2af0fc commit fc9bcd4
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
18 changes: 9 additions & 9 deletions src/data/political_party.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const POLITICAL_PARTIES = [
civil: 40,
societal: 30,
sovereignty: 35,
us_china_relation: 30,
us_vs_china: 30,
}
},
{
Expand All @@ -21,7 +21,7 @@ const POLITICAL_PARTIES = [
civil: 55,
societal: 60,
sovereignty: 75,
us_china_relation: 70,
us_vs_china: 70,
}
},
{
Expand All @@ -33,7 +33,7 @@ const POLITICAL_PARTIES = [
civil: 50,
societal: 40,
sovereignty: 75,
us_china_relation: 70,
us_vs_china: 70,
}
},
{
Expand All @@ -45,7 +45,7 @@ const POLITICAL_PARTIES = [
civil: 35,
societal: 25,
sovereignty: 20,
us_china_relation: 20,
us_vs_china: 20,
}
},
{
Expand All @@ -57,7 +57,7 @@ const POLITICAL_PARTIES = [
civil: 75,
societal: 75,
sovereignty: 75,
us_china_relation: 75,
us_vs_china: 75,
}
},
{
Expand All @@ -69,7 +69,7 @@ const POLITICAL_PARTIES = [
civil: 45,
societal: 50,
sovereignty: 45,
us_china_relation: 40,
us_vs_china: 40,
}
},
{
Expand All @@ -81,7 +81,7 @@ const POLITICAL_PARTIES = [
civil: 75,
societal: 60,
sovereignty: 75,
us_china_relation: 70,
us_vs_china: 70,
}
},
{
Expand All @@ -93,7 +93,7 @@ const POLITICAL_PARTIES = [
civil: 10,
societal: 20,
sovereignty: 10,
us_china_relation: 10,
us_vs_china: 10,
}
},
{
Expand All @@ -105,7 +105,7 @@ const POLITICAL_PARTIES = [
civil: 75,
societal: 75,
sovereignty: 75,
us_china_relation: 65,
us_vs_china: 65,
}
}
]
Expand Down
18 changes: 9 additions & 9 deletions src/data/question.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ const QUESTIONS = [
id: "q1101",
weight: {
sovereignty: -weights.p150,
us_china_relation: -weights.p100,
us_vs_china: -weights.p100,

tags: {
prc_unification: 1,
Expand All @@ -368,7 +368,7 @@ const QUESTIONS = [
id: "q1102",
weight: {
sovereignty: -weights.p100,
us_china_relation: -weights.p075,
us_vs_china: -weights.p075,
}
},
{
Expand All @@ -382,48 +382,48 @@ const QUESTIONS = [
{
id: "q1200",
weight: {
us_china_relation: weights.p100,
us_vs_china: weights.p100,
diplomatic: -5,
}
},
{
id: "q1201",
weight: {
us_china_relation: weights.p100,
us_vs_china: weights.p100,
}
},
{
id: "q1202",
weight: {
us_china_relation: weights.p100,
us_vs_china: weights.p100,
}
},
{
id: "q1203",
weight: {
sovereignty: weights.p050,
us_china_relation: weights.p100,
us_vs_china: weights.p100,
diplomatic: -weights.p050,
}
},
{
id: "q1300",
weight: {
us_china_relation: -weights.p100,
us_vs_china: -weights.p100,
diplomatic: weights.p050,
}
},
{
id: "q1301",
weight: {
sovereignty: -weights.p050,
us_china_relation: -weights.p100,
us_vs_china: -weights.p100,
}
},
{
id: "q1302",
weight: {
us_china_relation: -weights.p075,
us_vs_china: -weights.p075,
diplomatic: weights.p050,
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@
"6": "Firm Unification"
}
},
"us_china_relation": {
"title": "U.S. China Relations",
"us_vs_china": {
"title": "U.S. vs China",
"pro_american": "Pro-American",
"pro_chinese": "Pro-Chinese",
"categories": {
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"6": "坚实的中华民族拥护者"
}
},
"us_china_relation": {
"us_vs_china": {
"title": "美中",
"pro_american": "亲美",
"pro_chinese": "亲中",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@
"6": "堅定的中華民族擁護者"
}
},
"us_china_relation": {
"us_vs_china": {
"title": "美中",
"pro_american": "親美",
"pro_chinese": "親中",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/quiz/Quiz.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const calculateScores = (questions, choices) => {
societal: getScore(questions.map((value) => ({ id: value.id, weight: value.weight.societal || 0.0 }))),
diplomatic: getScore(questions.map((value) => ({ id: value.id, weight: value.weight.diplomatic || 0.0 }))),
sovereignty: getScore(questions.map((value) => ({ id: value.id, weight: value.weight.sovereignty || 0.0 }))),
us_china_relation: getScore(questions.map((value) => ({ id: value.id, weight: value.weight.us_china_relation || 0.0 }))),
us_vs_china: getScore(questions.map((value) => ({ id: value.id, weight: value.weight.us_vs_china || 0.0 }))),
tags: getTags(questions.map((value) => ({ id: value.id, tags: value.weight.tags }))).join(',')
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/pages/quiz/Result.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const getPoliticalPartyMatchScores = (weights) => {
distance += Math.pow(Math.abs(value.weight.environmental - weights.environmental), 2)
distance += Math.pow(Math.abs(value.weight.societal - weights.societal), 2)
distance += Math.pow(Math.abs(value.weight.sovereignty - weights.sovereignty), 2)
distance += Math.pow(Math.abs(value.weight.us_china_relation - weights.us_china_relation), 2)
distance += Math.pow(Math.abs(value.weight.us_vs_china - weights.us_vs_china), 2)
return {
...value,
distance: distance,
Expand Down Expand Up @@ -91,7 +91,7 @@ const Result = () => {
environmental: searchParams.get('environmental'),
societal: searchParams.get('societal'),
sovereignty: searchParams.get('sovereignty'),
us_china_relation: searchParams.get('us_china_relation'),
us_vs_china: searchParams.get('us_vs_china'),
}

const matchedTags = new Set(searchParams.get('tags').split(','))
Expand Down Expand Up @@ -412,15 +412,15 @@ const Result = () => {
leaningsTitle={t(`quiz.result.axes.sovereignty.categories.${getCategory(weights.sovereignty)}`)}
/>
<ValueCard
title={t('quiz.result.axes.us_china_relation.title')}
leftTitle={t('quiz.result.axes.us_china_relation.pro_american')}
rightTitle={t('quiz.result.axes.us_china_relation.pro_chinese')}
title={t('quiz.result.axes.us_vs_china.title')}
leftTitle={t('quiz.result.axes.us_vs_china.pro_american')}
rightTitle={t('quiz.result.axes.us_vs_china.pro_chinese')}
leftImage={FlagOfUSA}
rightImage={FlagOfPRC}
leftColor='navy'
rightColor='red'
percent={weights.us_china_relation}
leaningsTitle={t(`quiz.result.axes.us_china_relation.categories.${getCategory(weights.us_china_relation)}`)}
percent={weights.us_vs_china}
leaningsTitle={t(`quiz.result.axes.us_vs_china.categories.${getCategory(weights.us_vs_china)}`)}
/>
</Flex>
)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/quiz/Result.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const checkWeights = (weights, partyId) => {
expect(weights.societal).toBeLessThanOrEqual(party.weight.societal + threshold)
expect(weights.sovereignty).toBeGreaterThanOrEqual(party.weight.sovereignty - threshold)
expect(weights.sovereignty).toBeLessThanOrEqual(party.weight.sovereignty + threshold)
expect(weights.us_china_relation).toBeGreaterThanOrEqual(party.weight.us_china_relation - threshold)
expect(weights.us_china_relation).toBeLessThanOrEqual(party.weight.us_china_relation + threshold)
expect(weights.us_vs_china).toBeGreaterThanOrEqual(party.weight.us_vs_china - threshold)
expect(weights.us_vs_china).toBeLessThanOrEqual(party.weight.us_vs_china + threshold)
}

test('kmt', () => {
Expand Down

0 comments on commit fc9bcd4

Please sign in to comment.