Merge pull request 'Hotfixes' (#46) from dev into main
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			Reviewed-on: #46 Reviewed-by: Philipp Dormann <philipp@philippdormann.de>
This commit was merged in pull request #46.
	This commit is contained in:
		
							
								
								
									
										10
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								CHANGELOG.md
									
									
									
									
									
								
							@@ -2,11 +2,19 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
					All notable changes to this project will be documented in this file. Dates are displayed in UTC.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### [v0.5.2](https://git.odit.services/lfk/document-server/compare/v0.5.1...v0.5.2)
 | 
					#### [v0.5.3](https://git.odit.services/lfk/document-server/compare/v0.5.1...v0.5.3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- Merge branch 'bugfix/44-runner-certificates-result-in-a-status-500' into dev [`#44`](https://git.odit.services/lfk/document-server/issues/44)
 | 
					- Merge branch 'bugfix/44-runner-certificates-result-in-a-status-500' into dev [`#44`](https://git.odit.services/lfk/document-server/issues/44)
 | 
				
			||||||
 | 
					- Fixed Locale comma format [`2a33226`](https://git.odit.services/lfk/document-server/commit/2a3322612d473bd9002cf8d6f9807f9dc7d687da)
 | 
				
			||||||
- wrap distanceDonations.reduce in array length check [`bac004d`](https://git.odit.services/lfk/document-server/commit/bac004d74eb954d1753d4efcdb927822b89fa757)
 | 
					- wrap distanceDonations.reduce in array length check [`bac004d`](https://git.odit.services/lfk/document-server/commit/bac004d74eb954d1753d4efcdb927822b89fa757)
 | 
				
			||||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`ff0421d`](https://git.odit.services/lfk/document-server/commit/ff0421da2f16a8f79f9987dabea7bdcb4ef88c05)
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`ff0421d`](https://git.odit.services/lfk/document-server/commit/ff0421da2f16a8f79f9987dabea7bdcb4ef88c05)
 | 
				
			||||||
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`f846572`](https://git.odit.services/lfk/document-server/commit/f8465721cddfb55d51eb30d29d74ef63d825b5ac)
 | 
				
			||||||
 | 
					- Fix for runner donation array [`72303b1`](https://git.odit.services/lfk/document-server/commit/72303b11052276ad15373887f9e04183841f56f4)
 | 
				
			||||||
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`451b7fb`](https://git.odit.services/lfk/document-server/commit/451b7fbe0543991e8a203e38daa350a954ae0e11)
 | 
				
			||||||
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`573b921`](https://git.odit.services/lfk/document-server/commit/573b9211972a55df0a38742cb6eb789d6fd3717b)
 | 
				
			||||||
 | 
					- 🚀Bumped version to v0.5.3 [`01e1323`](https://git.odit.services/lfk/document-server/commit/01e1323555fe67f6f0ce3c18163e475035bd1cdd)
 | 
				
			||||||
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`4b4d66a`](https://git.odit.services/lfk/document-server/commit/4b4d66ae784150f7e1cc491a3fc5d84c93273aee)
 | 
				
			||||||
 | 
					- Merge pull request 'v0.5.2: hotfix TypeError in Runner Certificate generation' (#45) from dev into main [`c935950`](https://git.odit.services/lfk/document-server/commit/c935950eb052bce71185fc74c750ec77f081e7df)
 | 
				
			||||||
- 🚀Bumped version to v0.5.2 [`274c13e`](https://git.odit.services/lfk/document-server/commit/274c13e358f16207fe8bb5cdc1b9ede0582ecb46)
 | 
					- 🚀Bumped version to v0.5.2 [`274c13e`](https://git.odit.services/lfk/document-server/commit/274c13e358f16207fe8bb5cdc1b9ede0582ecb46)
 | 
				
			||||||
- 🧾New changelog file version [CI SKIP] [skip ci] [`b7b7f6a`](https://git.odit.services/lfk/document-server/commit/b7b7f6a0ae304d24f90a3de3931f53cf08770060)
 | 
					- 🧾New changelog file version [CI SKIP] [skip ci] [`b7b7f6a`](https://git.odit.services/lfk/document-server/commit/b7b7f6a0ae304d24f90a3de3931f53cf08770060)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "@odit/lfk-document-server",
 | 
					  "name": "@odit/lfk-document-server",
 | 
				
			||||||
  "version": "0.5.2",
 | 
					  "version": "0.5.3",
 | 
				
			||||||
  "description": "The document generation server for the LfK! runner system. This generates certificates, sponsoring aggreements and more",
 | 
					  "description": "The document generation server for the LfK! runner system. This generates certificates, sponsoring aggreements and more",
 | 
				
			||||||
  "main": "src/app.ts",
 | 
					  "main": "src/app.ts",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,13 +101,13 @@ export class PdfCreator {
 | 
				
			|||||||
        await Handlebars.registerHelper('--format_kilometers',
 | 
					        await Handlebars.registerHelper('--format_kilometers',
 | 
				
			||||||
            function (str) {
 | 
					            function (str) {
 | 
				
			||||||
                let meters = parseInt(str);
 | 
					                let meters = parseInt(str);
 | 
				
			||||||
                return ((meters / 1000).toFixed(3).toString())
 | 
					                return ((meters / 1000).toLocaleString("de-DE", { minimumFractionDigits: 1, maximumFractionDigits: 3 }))
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        await Handlebars.registerHelper('--format_currency',
 | 
					        await Handlebars.registerHelper('--format_currency',
 | 
				
			||||||
            function (str) {
 | 
					            function (str) {
 | 
				
			||||||
                let meters = parseInt(str);
 | 
					                let meters = parseInt(str);
 | 
				
			||||||
                return ((meters / 100).toFixed(2).toString())
 | 
					                return ((meters / 100).toLocaleString("de-DE", { minimumFractionDigits: 2, maximumFractionDigits: 2 }))
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
        this.browser = await puppeteer.launch({ headless: true, args: minimal_args });
 | 
					        this.browser = await puppeteer.launch({ headless: true, args: minimal_args });
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -98,8 +98,10 @@ export class PdfController {
 | 
				
			|||||||
                runner.group.fullName = `${runner.group.parentGroup.name}/${runner.group.name}`;
 | 
					                runner.group.fullName = `${runner.group.parentGroup.name}/${runner.group.name}`;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            runner.donationPerDistanceTotal = 0;
 | 
					            runner.donationPerDistanceTotal = 0;
 | 
				
			||||||
 | 
					            if (!Array.isArray(runner.distanceDonations)){
 | 
				
			||||||
 | 
					                runner.distanceDonations = [].concat(runner.distanceDonations)
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            if (runner.distanceDonations.length > 0) {
 | 
					            if (runner.distanceDonations.length > 0) {
 | 
				
			||||||
                console.log(typeof runner.distanceDonations);
 | 
					 | 
				
			||||||
                runner.donationPerDistanceTotal += runner.distanceDonations.reduce(function (sum, current) {
 | 
					                runner.donationPerDistanceTotal += runner.distanceDonations.reduce(function (sum, current) {
 | 
				
			||||||
                    return sum + current.amountPerDistance;
 | 
					                    return sum + current.amountPerDistance;
 | 
				
			||||||
                }, 0);
 | 
					                }, 0);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user