Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display 500 when access user own page #67

Closed
kyoncy opened this issue Jan 7, 2022 · 6 comments
Closed

Display 500 when access user own page #67

kyoncy opened this issue Jan 7, 2022 · 6 comments
Labels
Type: Bug Bug or Bug fixes

Comments

@kyoncy
Copy link

kyoncy commented Jan 7, 2022

#58 と同じようにエラーの共有ばかりになってしまい申し訳ありません。

2022年の寄付情報を入力しようとしたのですが、
エラーが発生してユーザーページを閲覧できなくなったため報告させていただきました。

Error:Cannot read property 'effectiveValue' of undefined.

https://philan.net/user/kyoncy

image

@azu
Copy link
Owner

azu commented Jan 7, 2022 via email

@azu azu added the Type: Bug Bug or Bug fixes label Jan 7, 2022
@azu
Copy link
Owner

azu commented Jan 7, 2022

export const parseBudgetsFromBudgetsSheet = (budgetsSheet: Schema$Sheet): BudgetItem[] => {
const START_OF_USER_DATA = 1;
const recordAllCells = budgetsSheet?.data?.[0].rowData;
const recordDataCells = recordAllCells?.slice(START_OF_USER_DATA) ?? [];
return recordDataCells
.filter((cell) => {
return cell.values !== undefined;
})
.map((cell) => {
// Year Budget Used Balance
const [Year, Budget, Used, Balance] = cell.values!;
return {
year: Number(Year.userEnteredValue?.stringValue),
budget: {
raw: Budget.effectiveValue?.numberValue,
value: Budget.formattedValue
},
used: {
raw: Used.effectiveValue?.numberValue,
value: Used.formattedValue
},
balance: {
raw: Balance.effectiveValue?.numberValue,
value: Balance.formattedValue
}
};
})
.filter((item) => {
return isBudgetItem(item);
})
.sort((a, b) => Number(a.year) - Number(b.year)) as BudgetItem[];
};

Budgetsのシートがパースできなくてエラーになってるように見えます。

SpreadSheetの"Budgets"のタブはどのような感じになっていますか?
値自体がない行が存在してるようには見えるのですが、 https://philan.net/philan/budget ページから入力してもいまいち再現できてなくて。
image

@azu
Copy link
Owner

azu commented Jan 7, 2022

cad7193 デバッグログを入れて確認してみたら、なぜか表示できるようになってしまいました…
うーん、エラーがキャッシュされていたという訳でもなさそうだったのになんでだろ…
とりあえずログをもうちょっと取れるようにしてみます。

azu added a commit that referenced this issue Jan 7, 2022
@azu
Copy link
Owner

azu commented Jan 7, 2022

c2ff473
でもう少し細かいログと、空の値があるようなセルは無視するような処理を入れてみました。

@kyoncy
Copy link
Author

kyoncy commented Jan 7, 2022

SpreadSheetの"Budgets"のタブはどのような感じになっていますか?

このようになっています。

image

今確認してみましたが、表示できていました。

このエラーが発生した際、
SpreadSheetを直接編集し "Budgets"タブのYear, Budget列しか入力せず、Used, Balance列を空にしていたので空の値が原因かもしれません。お手数おかけしました。

@azu
Copy link
Owner

azu commented Jan 7, 2022

Used, Balanceは式を使って動的な値になってる感じですね。( https://philan.net/philan/budget から入力すると自動的に追加される形にしていました)

image

とりあえず、表示できていそうなので一旦IssueはCloseします。
また表示できなくなっていたら遠慮なくRe-openして大丈夫です。
報告ありがとうございました

@azu azu closed this as completed Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

No branches or pull requests

2 participants