Reviewed-on: #375 Co-authored-by: miteruzo <miteruzo@naver.com> Co-committed-by: miteruzo <miteruzo@naver.com>
このコミットはPull リクエスト #375 でマージされました.
このコミットが含まれているのは:
@@ -62,6 +62,7 @@ export type GekanatorExtraQuestion = {
|
||||
priorityWeight: number }
|
||||
|
||||
export type StoredGekanatorQuestion = {
|
||||
recordId?: number
|
||||
id: string
|
||||
text: string
|
||||
kind: GekanatorQuestionKind
|
||||
@@ -71,6 +72,7 @@ export type StoredGekanatorQuestion = {
|
||||
exampleAnswers?: Record<`${ number }`, GekanatorAnswerValue> }
|
||||
|
||||
export type GekanatorQuestion = {
|
||||
recordId?: number
|
||||
id: string
|
||||
text: string
|
||||
kind: GekanatorQuestionKind
|
||||
@@ -148,7 +150,7 @@ const directExampleAnswerFor = (
|
||||
question: StoredGekanatorQuestion,
|
||||
post: Post,
|
||||
): GekanatorAnswerValue | null => {
|
||||
if (question.kind !== 'post_similarity')
|
||||
if (question.kind !== 'post_similarity' && question.kind !== 'tag')
|
||||
return null
|
||||
|
||||
const direct = question.exampleAnswers?.[String (post.id) as `${ number }`]
|
||||
@@ -348,6 +350,7 @@ export const restoreGekanatorQuestion = (
|
||||
const normalizedCondition = normalizeTitleLengthCondition (question.condition)
|
||||
const normalizedQuestion = {
|
||||
...question,
|
||||
recordId: question.recordId,
|
||||
id: normalizedCondition.type === 'title-length-at-least'
|
||||
? `title:length-at-least:${ normalizedCondition.length }`
|
||||
: question.id,
|
||||
@@ -367,6 +370,7 @@ export const storeGekanatorQuestion = (
|
||||
id: question.condition.type === 'title-length-greater-than'
|
||||
? `title:length-at-least:${ question.condition.length + 1 }`
|
||||
: question.id,
|
||||
recordId: question.recordId,
|
||||
text: question.text,
|
||||
kind: question.kind,
|
||||
condition: normalizeTitleLengthCondition (question.condition),
|
||||
@@ -581,7 +585,7 @@ export const saveGekanatorGame = async ({
|
||||
guessedPostId: number
|
||||
correctPostId: number
|
||||
answers: GekanatorAnswerLog[]
|
||||
}): Promise<{ id: number }> =>
|
||||
}): Promise<{ id: number; learnedExampleCount: number }> =>
|
||||
await apiPost ('/gekanator/games', {
|
||||
guessed_post_id: guessedPostId,
|
||||
correct_post_id: correctPostId,
|
||||
@@ -595,15 +599,18 @@ export const saveGekanatorGame = async ({
|
||||
|
||||
export const saveGekanatorQuestionSuggestion = async ({
|
||||
gekanatorGameId,
|
||||
existingQuestionId,
|
||||
questionText,
|
||||
answer,
|
||||
}: {
|
||||
gekanatorGameId: number
|
||||
questionText: string
|
||||
existingQuestionId?: number
|
||||
questionText?: string
|
||||
answer: GekanatorAnswerValue
|
||||
}): Promise<{ id: number; count: number }> =>
|
||||
await apiPost ('/gekanator/question_suggestions', {
|
||||
gekanator_game_id: gekanatorGameId,
|
||||
existing_question_id: existingQuestionId,
|
||||
question_text: questionText,
|
||||
answer })
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする