fix: handle the sorting of transformed files (#44724)
* fix: handle the sorting of transformed files We can't use the ext property, since that is transformed, but the history is maintained. * test: make solutions polyVinyls for sorting * refactor: inline prepareChallenge * refactor: make solutions polys in getChallenges * fix: convert each solution to a poly * fix: skip empty solutions * fix: get challenge file history in client * refactor: stop calling isPoly from the client * fix: remove debug console.log * refactor: remove unnecessary sorting step
This commit is contained in:
committed by
GitHub
parent
b1fb6adc39
commit
cacc4eacd7
@ -1,16 +1,14 @@
|
||||
exports.sortChallengeFiles = function sortChallengeFiles(challengeFiles) {
|
||||
const xs = challengeFiles.slice();
|
||||
// TODO: refactor this to use an ext array ['html', 'js', 'css'] and loop over
|
||||
// that.
|
||||
xs.sort((a, b) => {
|
||||
if (a.ext === 'html') return -1;
|
||||
if (b.ext === 'html') return 1;
|
||||
if (a.ext === 'css') return -1;
|
||||
if (b.ext === 'css') return 1;
|
||||
if (a.ext === 'jsx') return -1;
|
||||
if (b.ext === 'jsx') return 1;
|
||||
if (a.ext === 'js') return -1;
|
||||
if (b.ext === 'js') return 1;
|
||||
if (a.history[0] === 'index.html') return -1;
|
||||
if (b.history[0] === 'index.html') return 1;
|
||||
if (a.history[0] === 'styles.css') return -1;
|
||||
if (b.history[0] === 'styles.css') return 1;
|
||||
if (a.history[0] === 'index.jsx') return -1;
|
||||
if (b.history[0] === 'index.jsx') return 1;
|
||||
if (a.history[0] === 'script.js') return -1;
|
||||
if (b.history[0] === 'script.js') return 1;
|
||||
return 0;
|
||||
});
|
||||
return xs;
|
||||
|
Reference in New Issue
Block a user