- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
33 lines
836 B
JavaScript
33 lines
836 B
JavaScript
'use strict'
|
|
var util = require('util')
|
|
var TrackerBase = require('./tracker-base.js')
|
|
|
|
var Tracker = module.exports = function (name, todo) {
|
|
TrackerBase.call(this, name)
|
|
this.workDone = 0
|
|
this.workTodo = todo || 0
|
|
}
|
|
util.inherits(Tracker, TrackerBase)
|
|
|
|
Tracker.prototype.completed = function () {
|
|
return this.workTodo === 0 ? 0 : this.workDone / this.workTodo
|
|
}
|
|
|
|
Tracker.prototype.addWork = function (work) {
|
|
this.workTodo += work
|
|
this.emit('change', this.name, this.completed(), this)
|
|
}
|
|
|
|
Tracker.prototype.completeWork = function (work) {
|
|
this.workDone += work
|
|
if (this.workDone > this.workTodo) {
|
|
this.workDone = this.workTodo
|
|
}
|
|
this.emit('change', this.name, this.completed(), this)
|
|
}
|
|
|
|
Tracker.prototype.finish = function () {
|
|
this.workTodo = this.workDone = 1
|
|
this.emit('change', this.name, 1, this)
|
|
}
|