feat: editable gpa formula via bands, resume edu format per template, dedupe sections, word photo size, text justify
This commit is contained in:
+8
-5
@@ -338,6 +338,9 @@ function openDb(dbPath) {
|
||||
d.exec(fs.readFileSync(path.join(__dirname, '..', 'schema.sql'), 'utf8'));
|
||||
// 个人信息表兜底(确保任何挂载形态下都存在)
|
||||
d.exec("CREATE TABLE IF NOT EXISTS profile (id INTEGER PRIMARY KEY AUTOINCREMENT, uuid TEXT, content TEXT NOT NULL DEFAULT '{}', deleted_at TEXT, origin TEXT, hlc TEXT)");
|
||||
// 绩点公式:梯度带携带每档绩点(gp),各校规则不同可自行修改
|
||||
const hasGp = d.prepare("SELECT COUNT(*) AS c FROM pragma_table_info('grade_band') WHERE name='gp'").get().c;
|
||||
if (Number(hasGp) === 0) d.exec("ALTER TABLE grade_band ADD COLUMN gp REAL");
|
||||
migrateSync(d);
|
||||
ensureBuiltin(d);
|
||||
alignBuiltinUuids(d);
|
||||
@@ -889,7 +892,7 @@ function listFootprints(d, query) {
|
||||
if (score == null) return null;
|
||||
let hit = bands.find(b => score >= b.min && score < b.max);
|
||||
if (!hit) hit = bands.find(b => score >= b.min && score <= b.max);
|
||||
return hit ? { id: hit.id, label: hit.label, color: hit.color } : null;
|
||||
return hit ? { id: hit.id, label: hit.label, color: hit.color, gp: hit.gp ?? null } : null;
|
||||
};
|
||||
const semesters = d.prepare('SELECT * FROM semester WHERE ' + DEL + ' ORDER BY term DESC').all();
|
||||
const activeSemIds = new Set(semesters.map(s => s.id));
|
||||
@@ -1007,14 +1010,14 @@ function listFootprints(d, query) {
|
||||
withTx(d, () => {
|
||||
if (id) {
|
||||
const h = hlcNext(d);
|
||||
d.prepare('UPDATE grade_band SET label=?, color=?, min=?, max=?, sort=?, hlc=? WHERE id=?')
|
||||
.run(label, p.color ?? '#64748b', p.min, p.max, p.sort ?? 100, h, id);
|
||||
d.prepare('UPDATE grade_band SET label=?, color=?, min=?, max=?, sort=?, gp=?, hlc=? WHERE id=?')
|
||||
.run(label, p.color ?? '#64748b', p.min, p.max, p.sort ?? 100, p.gp ?? null, h, id);
|
||||
touchOplog(d, 'grade_band', getUuid(d, 'grade_band', id), 'upsert', h);
|
||||
} else {
|
||||
const h = hlcNext(d);
|
||||
const uuid = uuidv7();
|
||||
id = Number(d.prepare('INSERT INTO grade_band (label, color, min, max, sort, uuid, hlc, origin) VALUES (?,?,?,?,?,?,?,?)')
|
||||
.run(label, p.color ?? '#64748b', p.min, p.max, p.sort ?? 100, uuid, h, getDeviceId(d)).lastInsertRowid);
|
||||
id = Number(d.prepare('INSERT INTO grade_band (label, color, min, max, sort, gp, uuid, hlc, origin) VALUES (?,?,?,?,?,?,?,?,?)')
|
||||
.run(label, p.color ?? '#64748b', p.min, p.max, p.sort ?? 100, p.gp ?? null, uuid, h, getDeviceId(d)).lastInsertRowid);
|
||||
touchOplog(d, 'grade_band', uuid, 'upsert', h);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user