Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions competition.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ function listFiles() {
for (const f of files) {
if (f.endsWith('.cs')) {
out.push((dir + '/' + f).substring(2))
} else if (fs.lstatSync(process.env.SCRIPT_BASE + '/' + dir + '/' + f)) {
dirs.push(dir + '/' + f)
} else {
stats = fs.lstatSync(process.env.SCRIPT_BASE + '/' + dir + '/' + f);
if (stats.isDirectory()) {
dirs.push(dir + '/' + f)
}
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion group.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ class Group {

name() {
if (this.activityCode.isActivity()) {
return this.room.name.split(' ')[0] + ' ' + this.activityCode.groupNumber
// This is not ideal; when displaying room names we'd like to
Comment thread
viroulep marked this conversation as resolved.
// keep only the meaningful part (eg: "Red" when it's "Red Stage", which
// is usually the first part of the name in English, but may be some other
// parts in other languages. This is a compromise where we strip out
// 'Stage' or 'Room' suffix, which should be enough in "regular" major
// competitions setup while not messing up room names in non English setups.
return this.room.name.replace(/Room|Stage/g, '').trim() + ' ' + this.activityCode.groupNumber
} else {
return this.activityCode.toString()
}
Expand Down
1 change: 1 addition & 0 deletions parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ async function parse(text, req, res, ctx, allowParams) {
}
})
}
out.outputs.push({ type: 'CompetitionWCIF', data: ctx.competition })
Comment thread
viroulep marked this conversation as resolved.
} catch (e) {
out.outputs.splice(0, 0, {type: 'Exception', data: e.stack})
out.mutations = []
Expand Down
3 changes: 3 additions & 0 deletions views/dispatch.pug
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ mixin dispatch(value)
+dispatch(data)
if value.type == 'ListScriptsOutput'
+list_scripts(value.data)
if value.type == 'CompetitionWCIF'
a(href=`data:application/json;charset=utf-8,${encodeURIComponent(JSON.stringify(value.data))}`, target='_blank').
Open WCIF as JSON in a new tab
6 changes: 5 additions & 1 deletion views/groups.pug
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,9 @@ mixin groups(data)
td
a(href='https://wca.link/' + assignment.person.wcaId)= assignment.person.wcaId
td= assignment.person.countryIso2
td= fn.personalBest(assignment.person, data.round).toString()
- var pb = fn.personalBest(assignment.person, data.round)
if pb
td= pb.toString()
else
td= ""
td= assignment.set
4 changes: 2 additions & 2 deletions views/index.pug
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
html
head
title Nats Helper
title Compscript
body
h1 Nats Helper
h1 Compscript
each competition in competitions
p
a(href='/'+competition.id)= competition.name
2 changes: 1 addition & 1 deletion views/script.pug
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include dispatch.pug
html
head
title Nats Helper
title Compscript
style
include script.css
link(rel='stylesheet', href='/cubing-icons.css')
Expand Down