Comments (6)
Just to add one more thing: If I console.log the array "files" before and after the sort function, there is a difference, and the array after the sort function is in the correct order. But the csv file is always different, and there seems to be no pattern for the order.
from fitalyser.
I think the problem is that the node.js is tricky by working asynchroniously. It probably explains why "the table is still not sorted by date in descending order. The funny thing is, that if I am starting summaryTable.bat again and agan after deleting the table, the newly generated table is always sorted in a different way". That is, in the asynchronuios mode, one should non expect that the commands are executed in the strict sequence, the command can start earlier than a command before, it's a nightmare for programmers. It is my suggestiom, and honestly, I have no idea about sorting with the node.js promises
from fitalyser.
Just investigating further: Until this line (126) in utilities/summaryTable.js the "file" is correct:
fs.readFile(activitiesFolder + "/" + file, function (err, content) {
But if I console.log "file" after this line, "file" is suddenly different. How come?
from fitalyser.
Ended up with a very awkward "solution": At the end of summaryTable.js I added some code to open the CSV file, sort the entries and write the CSV file again. If I find the time I will probably think about a better solution ...
from fitalyser.
s I added some code to open the CSV file, sort the entries and write the CSV file again
if it's so, the reason is certainly because of asynchronuios features. Anyway, whatever working is better than anything not.
from fitalyser.
In the meantime I implemented a better solution. I changed the code in summaryTable.js from approx. line 173 on so that the array is already in the desired order and table.csv is only written once.
from fitalyser.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fitalyser.