qranswers 1.0.39 → 1.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/Api.js +25 -1
  2. package/package.json +1 -1
package/lib/Api.js CHANGED
@@ -271,7 +271,10 @@ const Api = {
271
271
  qPadding += "\t";
272
272
  }
273
273
  for (let i=0; i<C_ANSWER_FIELDS.length; i++) {
274
- pasteBuffer += 'answer.' + C_ANSWER_FIELDS[i] + "\t";
274
+ if (i !== 0) {
275
+ pasteBuffer += "\t";
276
+ }
277
+ pasteBuffer += 'answer.' + C_ANSWER_FIELDS[i];
275
278
  }
276
279
  pasteBuffer += "\n";
277
280
 
@@ -409,6 +412,27 @@ const Api = {
409
412
  const url = `${this._apiBase}/campaigns/unarchive/${campaignId}/${projectId}`;
410
413
  return await this.doFetch(url, 'PUT', {});
411
414
  },
415
+ // Question Assignments to Location(s) as part of a campaign (QuestionLocation table)
416
+ // {projectId, campaignId, locationId, questions[]}
417
+ // Uniqueness is campaignId + locationId - there can be only 1 w/ that combination
418
+ async assignQuestionsToLocation(locationId, campaignId, questions) {
419
+ const url = `${this._apiBase}/questionlocation/create/${locationId}/${campaignId}`;
420
+ return await this.doFetch(url, 'POST', {questions: questions})
421
+ },
422
+ async updateQuestionsAtLocation(locationId, campaignId, questions) {
423
+ const url = `${this._apiBase}/questionlocation/${locationId}/${campaignId}`;
424
+ return await this.doFetch(url, 'PUT', {questions: questions})
425
+ },
426
+ async getQuestionsAtLocation(locationId, campaignId) {
427
+ const url = `${this._apiBase}/questionlocation/${locationId}/${campaignId}`;
428
+ return await this.doFetch(url)
429
+ }
430
+
431
+ // Then need to qranswerspdfgen /rqa/questlocs?g=<campid>&force=true
432
+ // body: locations[{locationId: <>},...]
433
+
434
+ // Generate a PDF of the QR codes for the campaign
435
+
412
436
 
413
437
  }
414
438
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qranswers",
3
- "version": "1.0.39",
3
+ "version": "1.0.41",
4
4
  "description": "Helper module to access QR-Answers API",
5
5
  "main": "lib/qranswers.js",
6
6
  "scripts": {