Minor tweaks

This commit is contained in:
Peter Hart 2018-05-30 00:08:48 -04:00
parent ec735d0e33
commit 8040ef8f05
15 changed files with 4326 additions and 2561 deletions

31
README.org Normal file
View File

@ -0,0 +1,31 @@
#+TITLE: README for lane-slip-generator
This is written in kotlin JS. To run it, you'll need to install the
following tools:
nodejs/npm
then install the firebase tools:
npm install -g firebase-tools
Then do:
firebase init functions
to re-initialize the project, and finally, install the kotlin support
in the functions directory:
cd functions
npm install --save kotlin
Then do a build:
gradlew clean build
And you should be able to run the project:
firebase serve --only functions

4
README.org~ Normal file
View File

@ -0,0 +1,4 @@
#+TITLE: README for lane-slip-generator
This is written in kotlin JS

View File

@ -1,5 +1,5 @@
buildscript { buildscript {
ext.kotlin_version = '1.2.31' ext.kotlin_version = '1.2.41'
repositories { repositories {
mavenCentral() mavenCentral()
} }

View File

@ -1,2 +1 @@
{ {}
}

View File

@ -1,123 +0,0 @@
{
"parserOptions": {
// Required for certain syntax usages
"ecmaVersion": 6
},
"plugins": [
"promise"
],
"extends": "eslint:recommended",
"rules": {
// Removed rule "disallow the use of console" from recommended eslint rules
"no-console": "off",
// Removed rule "disallow multiple spaces in regular expressions" from recommended eslint rules
"no-regex-spaces": "off",
// Removed rule "disallow the use of debugger" from recommended eslint rules
"no-debugger": "off",
// Removed rule "disallow unused variables" from recommended eslint rules
"no-unused-vars": "off",
// Removed rule "disallow mixed spaces and tabs for indentation" from recommended eslint rules
"no-mixed-spaces-and-tabs": "off",
// Removed rule "disallow the use of undeclared variables unless mentioned in /*global */ comments" from recommended eslint rules
"no-undef": "off",
// Warn against template literal placeholder syntax in regular strings
"no-template-curly-in-string": 1,
// Warn if return statements do not either always or never specify values
"consistent-return": 1,
// Warn if no return statements in callbacks of array methods
"array-callback-return": 1,
// Require the use of === and !==
"eqeqeq": 2,
// Disallow the use of alert, confirm, and prompt
"no-alert": 2,
// Disallow the use of arguments.caller or arguments.callee
"no-caller": 2,
// Disallow null comparisons without type-checking operators
"no-eq-null": 2,
// Disallow the use of eval()
"no-eval": 2,
// Warn against extending native types
"no-extend-native": 1,
// Warn against unnecessary calls to .bind()
"no-extra-bind": 1,
// Warn against unnecessary labels
"no-extra-label": 1,
// Disallow leading or trailing decimal points in numeric literals
"no-floating-decimal": 2,
// Warn against shorthand type conversions
"no-implicit-coercion": 1,
// Warn against function declarations and expressions inside loop statements
"no-loop-func": 1,
// Disallow new operators with the Function object
"no-new-func": 2,
// Warn against new operators with the String, Number, and Boolean objects
"no-new-wrappers": 1,
// Disallow throwing literals as exceptions
"no-throw-literal": 2,
// Require using Error objects as Promise rejection reasons
"prefer-promise-reject-errors": 2,
// Enforce for loop update clause moving the counter in the right direction
"for-direction": 2,
// Enforce return statements in getters
"getter-return": 2,
// Disallow await inside of loops
"no-await-in-loop": 2,
// Disallow comparing against -0
"no-compare-neg-zero": 2,
// Warn against catch clause parameters from shadowing variables in the outer scope
"no-catch-shadow": 1,
// Disallow identifiers from shadowing restricted names
"no-shadow-restricted-names": 2,
// Enforce return statements in callbacks of array methods
"callback-return": 2,
// Require error handling in callbacks
"handle-callback-err": 2,
// Warn against string concatenation with __dirname and __filename
"no-path-concat": 1,
// Prefer using arrow functions for callbacks
"prefer-arrow-callback": 1,
// Return inside each then() to create readable and reusable Promise chains.
// Forces developers to return console logs and http calls in promises.
"promise/always-return": 2,
//Enforces the use of catch() on un-returned promises
"promise/catch-or-return": 2,
// Warn against nested then() or catch() statements
"promise/no-nesting": 1
}
}

View File

@ -151,13 +151,13 @@
var dashOptions = {}; var dashOptions = {};
dashOptions.space = 10; dashOptions.space = 10;
doc.moveTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(1.0))).lineTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(27.0))).dash(5, dashOptions).stroke(); doc.moveTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(1.0))).lineTo(get_asPoints(get_cm(10.25)), get_asPoints(get_cm(27.0))).dash(5, dashOptions).stroke();
doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(8.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(8.5))).dash(5, dashOptions).stroke(); doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(9.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(9.5))).dash(5, dashOptions).stroke();
doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(16.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(16.5))).dash(5, dashOptions).stroke(); doc.moveTo(get_asPoints(get_cm(1.0)), get_asPoints(get_cm(18.5))).lineTo(get_asPoints(get_cm(21.0)), get_asPoints(get_cm(18.5))).dash(5, dashOptions).stroke();
} }
function writeSlip($receiver, doc, x, y) { function writeSlip($receiver, doc, x, y) {
var xOffset = get_asPoints(get_cm(10.0)) * x; var xOffset = get_asPoints(get_cm(10.0)) * x;
var yOffset = get_asPoints(get_cm(8.0)) * y; var yOffset = get_asPoints(get_cm(8.0)) * y;
var leftMargin = get_asPoints(get_cm(1.0)) + xOffset; var leftMargin = get_asPoints(get_cm(0.9)) + xOffset;
var opts = {}; var opts = {};
opts.width = get_asPoints(get_cm(8.5)); opts.width = get_asPoints(get_cm(8.5));
opts.align = 'center'; opts.align = 'center';
@ -168,7 +168,7 @@
doc.font('Times-Roman'); doc.font('Times-Roman');
var eventY = get_asPoints(get_cm(2.3)) + yOffset; var eventY = get_asPoints(get_cm(2.3)) + yOffset;
doc.text('EVENT #' + $receiver.eventNbr + ' - ' + $receiver.event, leftMargin, eventY); doc.text('EVENT #' + $receiver.eventNbr + ' - ' + $receiver.event, leftMargin, eventY);
var lineSeparation = get_asPoints(get_cm(0.6)); var lineSeparation = get_asPoints(get_cm(1.0));
var laneY = eventY + lineSeparation; var laneY = eventY + lineSeparation;
doc.text('Lane:', leftMargin, laneY); doc.text('Lane:', leftMargin, laneY);
var colWidth = get_asPoints(get_cm(1.3)); var colWidth = get_asPoints(get_cm(1.3));

1
functions/index.js.map Normal file

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
// Kotlin.kotlin_module_metadata(513, "index", "H4sIAAAAAAAAAJVUTVMTQRDNfmR30knIuAiEBRVBRVFwCWh5BcFCSikraJXXZTNFttzsxN1ByN3iB3jy4MmDR8/+Af0J/B57JkNY8ORl35t+Pd39eqq2RCzvJ8BvCxyeJnHKgERx2u+GmYBKEqYsT+J+DuXtVGQDcD5wgUlgbaQDIOwTS8XeQQbWy1RAWR3B2RdZnB6CLS+D3WWhADc/jns9loEtWNgDiHivz1PMXi3wVoGvFfh6gT8p8KdgR7yPM7GPR2GSg7vJecLCFMpcdLEX6YZ59znvoCPBz4d6zZgAuye/LtbIYpZDNeJJwiIR8zQH+1WcS+2kzzOBRfewmLzpDZ2vbA3SsBdHbwd9rBvmb3icYpqzxY8OEgZmhO46WXi8hb2xtP0ujQVYHR5BrTtAQbDhIstMQVUH1VhuLJg84OrkDHYvxE3bYXaI69/IsnAAboZe44yB0+OdI+xXOc7w0j4+ERgnYAy8DExaApuUqIFfg5rgEJNazRLGbeQ2LSOX6GqsaJxUaFK/Ke/b9AaegN7U6pzGBY33ND5ulvxvpj9N7/pmMNYao4s+zN1esptGUA5qv0gJpfsoWSg9+FdaQqmC0sxVaZE+9KlX8wrhoIqJj64mTtFl1blGV3zi2Z4ZuEFDCrM0KOa2HLqKie7O6ZxUl2lLXlsaTrZ4JXMNNQdxXSKmz0/QW8WU96efDRlu0HnMqGOV+rMXw8CdS4GvxJz/bpJT0rRaZlDeDDyHOrIoIpHjIII+VzXWdLwucbdCx2R854+FtKEcKEovotcuqHeRMH5Ot+l19QAEH1f1Vkx1VwxGseqI1UZqfVjG2B2nE0hJi9ApX61h50y2aarmZwbSaZV6ZrS1t7b22tbe2tprW3tsa49ycT8MuaSKWtIkmp9RS6jRWf2oVlDVq1CeGriKkSADC8pkRY2s7rbGkM0Wk/7LwqXObT0PDvqFmFDy9W/wL9qlo788BQAA"); // Kotlin.kotlin_module_metadata(66049, "index", "H4sIAAAAAAAAAJVUTVMTQRDNfmR30knIuAiEBRVBRVFwCWh5BcFCSikraJXXZTNFttzsxN1ByN3iB3jy4MmDR8/+Af0J/B57JkNY8ORl35t+Pd39eqq2RCzvJ8BvCxyeJnHKgERx2u+GmYBKEqYsT+J+DuXtVGQDcD5wgUlgbaQDIOwTS8XeQQbWy1RAWR3B2RdZnB6CLS+D3WWhADc/jns9loEtWNgDiHivz1PMXi3wVoGvFfh6gT8p8KdgR7yPM7GPR2GSg7vJecLCFMpcdLEX6YZ59znvoCPBz4d6zZgAuye/LtbIYpZDNeJJwiIR8zQH+1WcS+2kzzOBRfewmLzpDZ2vbA3SsBdHbwd9rBvmb3icYpqzxY8OEgZmhO46WXi8hb2xtP0ujQVYHR5BrTtAQbDhIstMQVUH1VhuLJg84OrkDHYvxE3bYXaI69/IsnAAboZe44yB0+OdI+xXOc7w0j4+ERgnYAy8DExaApuUqIFfg5rgEJNazRLGbeQ2LSOX6GqsaJxUaFK/Ke/b9AaegN7U6pzGBY33ND5ulvxvpj9N7/pmMNYao4s+zN1esptGUA5qv0gJpfsoWSg9+FdaQqmC0sxVaZE+9KlX8wrhoIqJj64mTtFl1blGV3zi2Z4ZuEFDCrM0KOa2HLqKie7O6ZxUl2lLXlsaTrZ4JXMNNQdxXSKmz0/QW8WU96efDRlu0HnMqGOV+rMXw8CdS4GvxJz/bpJT0rRaZlDeDDyHOrIoIpHjIII+VzXWdLwucbdCx2R854+FtKEcKEovotcuqHeRMH5Ot+l19QAEH1f1Vkx1VwxGseqI1UZqfVjG2B2nE0hJi9ApX61h50y2aarmZwbSaZV6ZrS1t7b22tbe2tprW3tsa49ycT8MuaSKWtIkmp9RS6jRWf2oVlDVq1CeGriKkSADC8pkRY2s7rbGkM0Wk/7LwqXObT0PDvqFmFDy9W/wL9qlo788BQAA");

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,6 @@
"name": "functions", "name": "functions",
"description": "Cloud Functions for Firebase", "description": "Cloud Functions for Firebase",
"scripts": { "scripts": {
"lint": "eslint .",
"serve": "firebase serve --only functions", "serve": "firebase serve --only functions",
"shell": "firebase functions:shell", "shell": "firebase functions:shell",
"start": "npm run shell", "start": "npm run shell",
@ -10,14 +9,8 @@
"logs": "firebase functions:log" "logs": "firebase functions:log"
}, },
"dependencies": { "dependencies": {
"firebase-admin": "~5.12.0", "firebase-admin": "~5.12.1",
"firebase-functions": "^1.0.1", "firebase-functions": "^1.0.3"
"kotlin": "^1.2.31",
"pdfkit": "^0.8.3"
},
"devDependencies": {
"eslint": "^4.12.0",
"eslint-plugin-promise": "^3.6.0"
}, },
"private": true "private": true
} }

View File

@ -86,47 +86,3 @@ curl -O -J -H "Content-Type: application/json" 'http://localhost:5000/swimteamma
} }
] ]
}' }'
exit
,
{
"eventNbr":1,
"event":"Girls 8&U 100 Yd Medley Relay",
"lane":1,
"heat":3,
"swimmer":"B",
"team":"Delshire"
},
{
"eventNbr":19,
"event":"Boys 15-18 50 Yd Freestyle",
"lane":3,
"heat":5,
"swimmer":"Jack Hart",
"team":"Delshire"
},
{
"eventNbr":19,
"event":"Boys 15-18 50 Yd Freestyle",
"lane":6,
"heat":1,
"swimmer":"Joseph Obert",
"team":"Delshire"),
},
{
"eventNbr":1,
"event":"Girls 8&U 100 Yd Medley Relay",
"lane":1,
"heat":1,
"swimmer":"A",
"team":"Delshire"
},
{
"eventNbr":1,
"event":"Girls 8&U 100 Yd Medley Relay",
"lane":1,
"heat":3,
"swimmer":"B",
"team":"Delshire"
}

3664
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,9 @@
"description": "Lane Slip Generator", "description": "Lane Slip Generator",
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"kotlin": "^1.2.31", "firebase-admin": "^5.12.1",
"firebase-functions": "^1.0.3",
"kotlin": "^1.2.41",
"pdfkit": "^0.8.3" "pdfkit": "^0.8.3"
}, },
"devDependencies": {}, "devDependencies": {},

View File

@ -56,15 +56,15 @@ fun drawDashes(doc : dynamic) {
doc.moveTo(10.25.cm.asPoints, 1.0.cm.asPoints).lineTo(10.25.cm.asPoints, 27.0.cm.asPoints).dash(5, dashOptions).stroke() doc.moveTo(10.25.cm.asPoints, 1.0.cm.asPoints).lineTo(10.25.cm.asPoints, 27.0.cm.asPoints).dash(5, dashOptions).stroke()
doc.moveTo(1.0.cm.asPoints, 8.5.cm.asPoints).lineTo(21.0.cm.asPoints, 8.5.cm.asPoints).dash(5, dashOptions).stroke() doc.moveTo(1.0.cm.asPoints, 9.5.cm.asPoints).lineTo(21.0.cm.asPoints, 9.5.cm.asPoints).dash(5, dashOptions).stroke()
doc.moveTo(1.0.cm.asPoints, 16.5.cm.asPoints).lineTo(21.0.cm.asPoints, 16.5.cm.asPoints).dash(5, dashOptions).stroke() doc.moveTo(1.0.cm.asPoints, 18.5.cm.asPoints).lineTo(21.0.cm.asPoints, 18.5.cm.asPoints).dash(5, dashOptions).stroke()
} }
fun Entry.writeSlip(doc: dynamic, x: Int, y: Int) { fun Entry.writeSlip(doc: dynamic, x: Int, y: Int) {
val xOffset = 10.0.cm.asPoints * x val xOffset = 10.0.cm.asPoints * x
val yOffset = 8.0.cm.asPoints * y val yOffset = 8.0.cm.asPoints * y
val leftMargin = 1.0.cm.asPoints + xOffset val leftMargin = 0.9.cm.asPoints + xOffset
val opts = js("{}") val opts = js("{}")
opts.width=8.5.cm.asPoints opts.width=8.5.cm.asPoints
@ -82,7 +82,7 @@ fun Entry.writeSlip(doc: dynamic, x: Int, y: Int) {
val eventY = 2.3.cm.asPoints + yOffset val eventY = 2.3.cm.asPoints + yOffset
doc.text("EVENT #${eventNbr} - ${event}", leftMargin, eventY) doc.text("EVENT #${eventNbr} - ${event}", leftMargin, eventY)
val lineSeparation = 0.6.cm.asPoints val lineSeparation = 1.0.cm.asPoints
val laneY = eventY + lineSeparation val laneY = eventY + lineSeparation
doc.text("Lane:", leftMargin, laneY) doc.text("Lane:", leftMargin, laneY)