MCPcopy
hub / github.com/Doorman11991/smallcode / complete

Method complete

src/session/contract_store.js:174–190  ·  view source on GitHub ↗
(opts = {})

Source from the content-addressed store, hash-verified

172 }
173
174 complete(opts = {}) {
175 const id = opts.contractId || this.activeId();
176 if (!id) throw new Error('no active contract');
177 const c = this.get(id);
178 if (!c) throw new Error(`contract missing: ${id}`);
179 if (!c.isDone()) {
180 const status = c.doneStatus();
181 throw new Error(
182 `cannot complete: ${status.pending} pending, ${status.failed} failed. ` +
183 `blockers: ${status.blockers.map((b) => b.id).join(', ')}`,
184 );
185 }
186 c.status = STATUSES.COMPLETED;
187 this.save(c);
188 this._log(c.id, 'complete', {});
189 return c;
190 }
191
192 _log(id, event, data) {
193 try {

Callers 1

contract.test.jsFile · 0.80

Calls 6

activeIdMethod · 0.95
getMethod · 0.95
saveMethod · 0.95
_logMethod · 0.95
isDoneMethod · 0.80
doneStatusMethod · 0.80

Tested by

no test coverage detected