Phase 3: Implement personalization signals (branch/year onboarding + ranking boost)

已关闭
#34 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Aryan-Techie 已经在做这个了。

开始于 2026年10月20日。

  • #105 来自 @Aryan-Techie —— 未关闭

评估

难度
5/5
预计耗时
一周以上
新手友好度
45/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
postgresql, supabase, typescript

调研方向

Start with PRD §8.8 and inspect src/db/schema.ts, src/app/onboarding/page.tsx, src/app/onboarding/actions.ts, src/lib/resources.ts, src/components/directory/directory-client.tsx, src/proxy.ts, and scripts/normalize-data.ts. Trace the existing authentication, directory sorting, resource tags, and database conventions before choosing among the listed branch-mapping options. Done means optional branch/year onboarding, persisted profiles, incomplete-profile routing, and a non-filtering personalized ranking are covered by the acceptance criteria.

由索引模型根据 Issue 内容生成。

描述

enhancement

Description

Implement personalization signals as specified in PRD §8.8. This is a P1 requirement for Phase 3.

Acceptance Criteria (from PRD §8.8)

  • Onboarding asks branch + year (optional, skippable)
  • Resources tagged to a branch (e.g., MATLAB, SolidWorks → ECE/Mechanical) sort higher for matching users — a ranking boost, never a hard filter

Current State

  • No user profile table exists yet (only Supabase auth.users)
  • Resources have tags but no branch mapping
  • No onboarding flow exists
  • Directory sorting currently: recommended (Fuse.js relevance), name, recent

Implementation Plan

  1. Create profiles table (extends Supabase auth.users):
    • userId (uuid, PK, references auth.users)
    • branch (text, nullable) - e.g., "CSE", "ECE", "Mechanical", "Civil", etc.
    • year (integer, nullable) - 1, 2, 3, 4, 5+
    • completedOnboarding (boolean, default false)
  2. Add branch tags to resources:
    • Map existing tags to branches (e.g., "MATLAB" → "ECE", "SolidWorks" → "Mechanical")
    • Could add branchTags column to resources or use existing tags with a mapping
  3. Onboarding flow:
    • After first sign-in, redirect to /onboarding if not completed
    • Simple form: branch (select), year (select), skip button
    • Store in profiles table
  4. Personalized sorting:
    • New sort option: "For you" (default for logged-in users with profile)
    • Boost resources matching user's branch/year
    • Ranking boost, not hard filter — all resources still visible

Files to Create/Modify

  • src/db/schema.ts - add profiles table
  • src/app/onboarding/page.tsx (new) - onboarding form
  • src/app/onboarding/actions.ts (new) - Server Action to save profile
  • src/lib/resources.ts - add getUserProfile(), getPersonalizedResources()
  • src/components/directory/directory-client.tsx - add "For you" sort option
  • src/proxy.ts - redirect to onboarding if profile incomplete
  • scripts/normalize-data.ts - add branch tag mapping (or separate seed)

Database Schema Addition

export const profiles = pgTable('profiles', {
  userId: uuid('user_id').notNull().references(() => auth.users.id).primaryKey(),
  branch: text('branch'), // 'CSE', 'ECE', 'Mechanical', 'Civil', 'EEE', etc.
  year: integer('year'), // 1, 2, 3, 4, 5
  completedOnboarding: boolean('completed_onboarding').notNull().default(false),
  createdAt: timestamp('created_at').notNull().defaultNow(),
  updatedAt: timestamp('updated_at').notNull().defaultNow(),
}).enableRLS();

Branch Mapping Strategy

Option A: Add branchTags array column to resources (explicit mapping)
Option B: Use existing tags with a static mapping in code (e.g., BRANCH_TAG_MAP = { 'MATLAB': 'ECE', ... })
Option C: Add branch column to resources (single branch per resource)

Recommend Option B for simplicity - use existing tags with a mapping config.

Sorting Algorithm

  • Base score from Fuse.js (if searching) or 1.0
  • If user has branch: +0.5 for each matching branch tag
  • If user has year: +0.2 for resources relevant to that year (e.g., internships for year 3-4)
  • Sort by combined score descending
主要语言
TypeScript
星标
1
派生
6
平均合并
1 天 2 小时
30 天内合并 PR
47

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。