-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore hours spent on WRs with unapproved quotes.
This new behaviour is enabled by the "free_presales" config option. This change also includes significant refactoring of get_sla_hours.js, fixing some of the lingering crapness in composite API calls.
- Loading branch information
Showing
7 changed files
with
201 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var util = require('./util'); | ||
|
||
let empty_fn = function(){}; | ||
|
||
const DEBUG = false; | ||
|
||
// A shim for http.Response that makes it easier for us to | ||
// build composite APIs like sla_hours, which relies | ||
// on approved_quotes and pending_quotes under the hood. | ||
function Response(handler){ | ||
this.handler = handler || empty_fn; | ||
} | ||
|
||
Response.prototype.charSet = empty_fn; | ||
|
||
Response.prototype.json = function(j){ | ||
util.log_debug(__filename, JSON.stringify(j, null, 2), DEBUG); | ||
this.handler(j); | ||
} | ||
|
||
module.exports = function(fn, ctx, next){ | ||
util.log_debug(__filename, JSON.stringify(ctx, null, 2), DEBUG); | ||
let res = new Response(next); | ||
fn({}, res, empty_fn, ctx); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.