3 Commits

Author SHA1 Message Date
e27d42d37d fix: Error returned from Code::Stats
Signed-off-by: Avior <f.bouillon@aptatio.com>
2022-12-07 16:23:57 +01:00
9e81ea201d fix: NaN Error while generating
Signed-off-by: Avior <f.bouillon@aptatio.com>
2022-12-07 16:19:40 +01:00
d3963900e7 fix: number that should be text
Signed-off-by: Avior <f.bouillon@aptatio.com>
2022-12-07 15:31:59 +01:00
3 changed files with 14 additions and 2 deletions

View File

@ -30,6 +30,8 @@ RUN npm run build
RUN npm ci --omit=dev RUN npm ci --omit=dev
ENV NODE_ENV=production
# Expose port # Expose port
EXPOSE 3000 EXPOSE 3000

View File

@ -21,6 +21,12 @@ app.get('/', async (req, res) => {
// Generate the STL // Generate the STL
const bfr = await generateThingy(username, yearN) const bfr = await generateThingy(username, yearN)
if (!bfr) {
res.status(500)
.send('It seems the generator could not generate, Please open an issue on Github https://github.com/aviortheking/codestats-skyline/issues/new')
return
}
// force download the STL with a good name // force download the STL with a good name
res res
.setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`) .setHeader('Content-Disposition', `attachment; filename=${username}-${year ? year : 'full'}.stl`)

View File

@ -60,7 +60,7 @@ export const generateThingy = async (username: string, filterYear?: number): Pro
if (month === '') { if (month === '') {
continue continue
} }
correctedData[month] = Array(31).fill(0) correctedData[month] = Array(32).fill(0)
} }
// loop through each dates // loop through each dates
@ -102,7 +102,11 @@ export const generateThingy = async (username: string, filterYear?: number): Pro
final += `max = ${max};\n` final += `max = ${max};\n`
final += `min = ${min};\n` final += `min = ${min};\n`
final += `text = "${username}";\n` final += `text = "${username}";\n`
final += `year = ${filterYear};\n` final += `year = "${filterYear}";\n`
if (process.env.NODE_ENV !== 'production') {
console.log(final)
}
// Fetch the CAD file // Fetch the CAD file
let cadPath = './3d.scad' let cadPath = './3d.scad'