Repository navigation
feat(tracker): manage optional subjects and excluded subjects in tracker and profile #419
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a6029a9
fix(forum): filter subjects and chapters by is_trackable
trtajim d40ea5e
feat(tracker): manage optional subjects and excluded subjects in trac…
trtajim 7639c2b
refactor(tracker): switch to include-first optional subjects selectio…
trtajim cad2883
feat(tracker): add eye-catching optional subjects callout banner and …
trtajim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...tions/2026_10_13_155150_add_is_optional_to_subjects_and_optional_subject_ids_to_users.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| <?php | ||
|
|
||
| use Illuminate\Database\Migrations\Migration; | ||
| use Illuminate\Database\Schema\Blueprint; | ||
| use Illuminate\Support\Facades\DB; | ||
| use Illuminate\Support\Facades\Schema; | ||
|
|
||
| return new class extends Migration | ||
| { | ||
| /** | ||
| * Run the migrations. | ||
| */ | ||
| public function up(): void | ||
| { | ||
| Schema::table('subjects', function (Blueprint $table) { | ||
| $table->boolean('is_optional')->default(false)->after('is_trackable'); | ||
| }); | ||
|
|
||
| Schema::table('users', function (Blueprint $table) { | ||
| $table->json('optional_subject_ids')->nullable()->after('group'); | ||
| }); | ||
|
|
||
| // Seed initial known optional subjects by unique slug: | ||
| $optionalSlugs = [ | ||
| // HSC Science | ||
| 'hsc-hmath-1st', | ||
| 'hsc-hmath-2nd', | ||
| 'hsc-biology-1st', | ||
| 'hsc-biology-2nd', | ||
| // SSC Science | ||
| 'ssc-biology', | ||
| 'ssc-higher-math', | ||
| // HSC Commerce | ||
| 'hsc-finance-1st', | ||
| 'hsc-finance-2nd', | ||
| 'hsc-marketing-1st', | ||
| 'hsc-marketing-2nd', | ||
| // HSC Humanities | ||
| 'hsc-economics-1st', | ||
| 'hsc-economics-2nd', | ||
| 'hsc-logic-1st', | ||
| 'hsc-logic-2nd', | ||
| 'hsc-islamic-history-1st', | ||
| 'hsc-islamic-history-2nd', | ||
| ]; | ||
|
|
||
| DB::table('subjects')->whereIn('slug', $optionalSlugs)->update(['is_optional' => true]); | ||
| } | ||
|
|
||
| /** | ||
| * Reverse the migrations. | ||
| */ | ||
| public function down(): void | ||
| { | ||
| Schema::table('users', function (Blueprint $table) { | ||
| $table->dropColumn('optional_subject_ids'); | ||
| }); | ||
|
|
||
| Schema::table('subjects', function (Blueprint $table) { | ||
| $table->dropColumn('is_optional'); | ||
| }); | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: hscstack/platform
Length of output: 11806
🏁 Script executed:
Repository: hscstack/platform
Length of output: 15961
🏁 Script executed:
Repository: hscstack/platform
Length of output: 41360
Invalidate the existing forum cache when applying this filter change.
Both actions reuse
forum_filter_subjects, but this migration updates subjects throughDB::table(...), soSubjectObserverdoes not clear the cache. An entry created by the old query can therefore continue returning untrackable subjects and nodes for up to one day. Clear the key in the migration, or ensure deployment performs the same invalidation.🐛 Suggested fix
🧰 Tools
🪛 PHPStan (2.2.14)
[error] 68-68: Call to an undefined static method App\Models\Subject::where().
(staticMethod.notFound)
🤖 Prompt for AI Agents