Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,4 @@ This direction can be evaluated through:

This is a general educational motivation engine. It is not only for internships, and it is not only a points table. It is a self-regulated learning support system and research direction that helps students see their progress, stay encouraged, recover from setbacks, and complete any meaningful learning journey.
Displaying PRODUCT.md.

1,042 changes: 384 additions & 658 deletions client/src/main.jsx

Large diffs are not rendered by default.

328 changes: 153 additions & 175 deletions client/src/styles.css

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions server/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,15 @@ export const SESSION_THRESHOLDS_MINUTES = {
};

export const SESSION_THRESHOLDS_PCT = 0.75; // default % of session duration to qualify

// --- SP Investment Vault --------------------------------------------------
// Configurable plans. Adding a new plan = add a key here, no code changes.
// attendanceRequirement is a fraction (1.0 = 100% of sessions in the window
// must be attended). durationDays and bonusRate are captured at start time so
// changing a plan mid-flight doesn't affect in-progress investments.
export const INVESTMENT_PLANS = {
safe: { label: 'Safe', durationDays: 7, bonusRate: 0.05, attendanceRequirement: 1.0 },
growth: { label: 'Growth', durationDays: 15, bonusRate: 0.15, attendanceRequirement: 1.0 },
diamond:{ label: 'Diamond', durationDays: 30, bonusRate: 0.30, attendanceRequirement: 1.0 }
};
export const INVESTMENT_MIN_PRINCIPAL = 10;
28 changes: 28 additions & 0 deletions server/models/InvestmentRecord.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import mongoose from 'mongoose';

const investmentRecordSchema = new mongoose.Schema({
email: { type: String, required: true, lowercase: true, trim: true, index: true },
studentId: { type: mongoose.Schema.Types.ObjectId, ref: 'Student', index: true },
planKey: { type: String, required: true },
principal: { type: Number, required: true },
bonusRate: { type: Number, required: true },
durationDays: { type: Number, required: true },
attendanceRequirement: { type: Number, required: true },
startDate: { type: Date, required: true, index: true },
endDate: { type: Date, required: true, index: true },
status: {
type: String,
enum: ['active', 'completed', 'failed', 'cancelled'],
default: 'active',
index: true
},
resolvedAt: { type: Date, default: null },
attendedSessions: { type: Number, default: null },
requiredSessions: { type: Number, default: null },
transactionIds: [{ type: mongoose.Schema.Types.ObjectId, ref: 'SPTransaction' }]
}, { timestamps: true });

investmentRecordSchema.index({ email: 1, status: 1 });
investmentRecordSchema.index({ endDate: 1, status: 1 });

export default mongoose.model('InvestmentRecord', investmentRecordSchema);
Loading