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
複数LMSのサポート #192
複数LMSのサポート #192
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ties-makimura/chibi-ch-i-lo/oyitxvuyn |
4110956
to
9f809a1
Compare
- 環境変数からではなく `lti_consumer` テーブルから見つける
- create Problem component
9f809a1
to
95744a4
Compare
- 代わりに LtiLaunchBody.launch_presentation_return_url を使う
95744a4
to
b963a5e
Compare
「確認したこと」に記載のあるコマンドを実行して、私のローカル環境でも正常にLTIリンクからちびチロにアクセスできることを確認しました! |
server/prisma/seed.ts
Outdated
await Promise.all( | ||
ltiResourceLinks | ||
.map((link) => ({ ...link, bookId: createdBooks[0].id })) | ||
.map(upsertLtiResourceLink) | ||
); | ||
for (const link of ltiResourceLinks) { | ||
await upsertLtiResourceLink({ | ||
...link, | ||
consumerId: ltiConsumer.id, | ||
bookId: createdBooks[0].id, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Promise.allを使ったほうが効率がよさそうに思ったのですが、
ba3b76c のコミットメッセージをみると、一連のPromiseにたいして非同期にupsertすると、insertで?重複するので、個別にawaitすることで解決した、という意味なのかなと思いました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
私の手元の環境だけかもしれませんが、
await Promise.all(topics.map((topic) => upsertTopic(authorId, topic)));
初回実行時にこの部分で重複するIDのトピック1つ必ず作られており修正しました。
Prismaの実装を詳しく追ったわけでないので正確なことは分かりませんがおそらくON CONFLICT句等でアトミックにINSERTしているわけではなくSELECTクエリとINSERTクエリそれぞれ発行されて1つ前のINSERTの実行以前にSELECTが実行されるなどの要因で誤ったINSERTやUPDATEが発行されているのではないかという仮説があり、とりあえずfor文で直列に実行されるように対処して初回実行時にupsertたちが失敗しないように修正しました。(今読み返すとupsertUserの部分も修正しておくべきですね。。。)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prisma/prisma#3242 これかな?
@@ -13,18 +13,16 @@ import { pagesPath } from "$utils/$path"; | |||
export type Query = BookEditQuery; | |||
|
|||
function Import({ bookId, context }: BookEditQuery) { | |||
const { data: session } = useSession(); | |||
const { isTopicEditable } = useSessionAtom(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isTopicEditableとisBookEditableをuseSessionInitで用意してから使いまわせるようにしたんですね、スッキリしましたね!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さそうに思いました!
マージします。 |
close #180
!! NOTICE: 破壊的な変更が含まれます !!
lti_consumer
テーブルから見つける本番環境での移行方法
マイグレーション後、次のようなSQLを実行してください。 (@ties-makimura)
例:
OAuth Consumer key:
{key}
OAuth Consumer secret:
{secret}
の場合
その他詳しい情報は README にも記載してます。
ご確認のほどよろしくお願いします。
確認したこと
ローカル環境でマイグレーションが機能することを確認。
以前のバージョンをチェックアウトしマイグレーション・シーディングした後でも同様に機能することを確認。
いずれも問題無くパス。
LMSのリンク(とその更新)も機能している。