Manage Group has no section for FILE instruments, so they cannot be enabled or disabled for a group

オープン 初心者向け
#1,774 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
85/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
react, typescript
領域
frontend

調査の方向性

まず apps/web/src/routes/_app/group/manage.tsx を確認します。特に CategorizedInstruments 型と、885~917 行付近の分類ループに注目し、その後 admin/instruments.tsx:169 の FILE の処理と比較します。次に、指定された manage.test.tsx のケースと group-manage の spec を実行します。FILE の楽器が機能する選択コントロール付きで表示され、チェックを外した楽器を保存すると Administer Instrument から削除されれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Area: Web Bug Difficulty: Low Priority: Medium

The Manage Group page lists a group's instruments in three sections: Forms, Interactive and Series. It has no section for FILE instruments. The page builds those sections from GET /v1/instruments/info, which does return FILE instruments, but the categorising loop only has branches for FORM, INTERACTIVE and SERIES, so a FILE instrument is counted as visible and then pushed nowhere. A group manager can therefore neither see nor change whether a FILE instrument is available to their group. FILE instruments that exist when a group is created are connected to it automatically (GroupsService.create connects every non-repo instrument), and stay switched on with no way to turn them off. A FILE instrument imported from a repository, or uploaded after the group was created, can never be switched on, so it never appears in Administer Instrument for that group. The admin Instruments page (admin/instruments.tsx:169) already handles FILE, so this page is the odd one out.

Where

apps/web/src/routes/_app/group/manage.tsx:58-62:

type CategorizedInstruments = {
  form: InstrumentItem[];
  interactive: InstrumentItem[];
  series: SeriesInstrumentItem[];
};

and manage.tsx:885-917, where visibleIds.add(instrument.id) runs for every kind but the item is pushed only for three of them:

visibleIds.add(instrument.id);
// ...
if (instrument.kind === 'FORM') {
  instruments.form.push(item);
} else if (instrument.kind === 'INTERACTIVE') {
  instruments.interactive.push(item);
} else if (instrument.kind === 'SERIES') {
  instruments.series.push({ ...item, seriesItems: instrument.seriesItems });
}

Reproduce

  1. Run a development instance with demo data (it seeds the built-in MRI Scan Session and Arbitrary File Upload FILE instruments before creating the demo groups).
  2. As a group manager, start a session and open Administer Instrument: MRI Scan Session is offered.
  3. Open Manage Group.

Actual: MRI Scan Session and Arbitrary File Upload appear in none of the sections, so they cannot be unticked. Likewise, a FILE instrument from a repository assigned to the group is never listed and cannot be ticked.
Expected: a "File" section (or FILE instruments within an existing section) lists them with the same checkbox, repository badge and preview as the other kinds, and saving honours the selection.

Tests

  • apps/web/src/routes/_app/group/__tests__/manage.test.tsx: it('should list FILE instruments so a group manager can enable or disable them') and it('should remove a FILE instrument from the group when it is unticked and saved').
  • testing/src/specs/group-manage.spec.ts: untick MRI Scan Session, save, and assert it no longer appears in Administer Instrument.

Suggested fix

Add a file bucket to CategorizedInstruments, push kind === 'FILE' items into it, and render it with InstrumentSection under a translated "File" heading. Ending the chain with an exhaustive match / satisfies never would make the next new kind fail to compile instead of disappearing silently.

主要言語
TypeScript
スター
119
フォーク
19
平均マージ
6日 16分
マージ済み PR(30日)
34

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DouglasNeuroInformatics/OpenDataCapture のほかの issue

DouglasNeuroInformatics/OpenDataCapture の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。