Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
arsnova-click-v2-backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
ARSnova
arsnova-click-v2-backend
Commits
4da51c60
Commit
4da51c60
authored
Aug 03, 2018
by
Christopher Mark Fullarton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes tests
parent
052c2a29
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
242 additions
and
151 deletions
+242
-151
src/cache/assets.ts
src/cache/assets.ts
+2
-2
src/db/AbstractDAO.ts
src/db/AbstractDAO.ts
+1
-1
src/db/CasDAO.ts
src/db/CasDAO.ts
+1
-1
src/db/ExpiryQuizDAO.ts
src/db/ExpiryQuizDAO.ts
+1
-1
src/db/I18nDAO.ts
src/db/I18nDAO.ts
+1
-1
src/db/LoginDAO.ts
src/db/LoginDAO.ts
+1
-1
src/db/QuizManagerDAO.ts
src/db/QuizManagerDAO.ts
+2
-2
src/export/excel-workbook.ts
src/export/excel-workbook.ts
+14
-6
src/export/excel-worksheet-choice-multiple.ts
src/export/excel-worksheet-choice-multiple.ts
+4
-4
src/export/excel-worksheet-choice-single.ts
src/export/excel-worksheet-choice-single.ts
+4
-4
src/export/excel-worksheet-freetext.ts
src/export/excel-worksheet-freetext.ts
+31
-17
src/export/excel-worksheet-ranged.ts
src/export/excel-worksheet-ranged.ts
+48
-27
src/export/excel-worksheet-summary.ts
src/export/excel-worksheet-summary.ts
+38
-14
src/export/excel-worksheet-survey.ts
src/export/excel-worksheet-survey.ts
+24
-13
src/export/excel-worksheet.ts
src/export/excel-worksheet.ts
+7
-3
src/export/lib/excel_function_library.ts
src/export/lib/excel_function_library.ts
+1
-1
src/leaderboard/leaderboard.ts
src/leaderboard/leaderboard.ts
+4
-4
src/nicknames/availableNicks.ts
src/nicknames/availableNicks.ts
+17
-9
src/quiz-manager/quiz-manager.ts
src/quiz-manager/quiz-manager.ts
+3
-3
src/routes/expiry-quiz.ts
src/routes/expiry-quiz.ts
+2
-2
src/routes/i18n-api.ts
src/routes/i18n-api.ts
+1
-1
src/routes/legacy-api.ts
src/routes/legacy-api.ts
+1
-1
src/routes/lib.ts
src/routes/lib.ts
+6
-6
src/routes/lobby.ts
src/routes/lobby.ts
+1
-1
src/routes/member.ts
src/routes/member.ts
+2
-2
src/routes/quiz.ts
src/routes/quiz.ts
+5
-5
src/routes/websocket.ts
src/routes/websocket.ts
+2
-2
src/tests/LoadTester.ts
src/tests/LoadTester.ts
+4
-4
src/tests/export/export.test.ts
src/tests/export/export.test.ts
+3
-3
src/tests/routes/legacy-api.test.ts
src/tests/routes/legacy-api.test.ts
+1
-1
src/tests/routes/lib.test.ts
src/tests/routes/lib.test.ts
+1
-1
src/tests/routes/lobby.test.ts
src/tests/routes/lobby.test.ts
+1
-1
src/tests/routes/member.test.ts
src/tests/routes/member.test.ts
+1
-1
src/tests/routes/quiz.test.ts
src/tests/routes/quiz.test.ts
+5
-4
tsconfig.json
tsconfig.json
+2
-2
No files found.
src/cache/assets.ts
View file @
4da51c60
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
src
/answeroptions/interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
dist
/answeroptions/interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
*
as
Hex
from
'
crypto-js/enc-hex
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
request
from
'
request
'
;
...
...
src/db/AbstractDAO.ts
View file @
4da51c60
import
{
IStorageDAO
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IStorageDAO
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
export
abstract
class
AbstractDAO
<
T
>
implements
IStorageDAO
<
T
>
{
protected
static
instance
;
...
...
src/db/CasDAO.ts
View file @
4da51c60
import
{
ICasData
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
ICasData
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
AbstractDAO
}
from
'
./AbstractDAO
'
;
class
CasDAO
extends
AbstractDAO
<
{
[
key
:
string
]:
ICasData
}
>
{
...
...
src/db/ExpiryQuizDAO.ts
View file @
4da51c60
import
{
IQuestionGroup
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IQuestionGroup
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
AbstractDAO
}
from
'
./AbstractDAO
'
;
class
ExpiryQuizDAO
extends
AbstractDAO
<
IQuestionGroup
>
{
...
...
src/db/I18nDAO.ts
View file @
4da51c60
import
{
ICommitAction
,
IGitlabCommitAction
}
from
'
arsnova-click-v2-types/
src
/gitlab/apiv4
'
;
import
{
ICommitAction
,
IGitlabCommitAction
}
from
'
arsnova-click-v2-types/
dist
/gitlab/apiv4
'
;
import
{
spawnSync
}
from
'
child_process
'
;
import
*
as
fs
from
'
fs
'
;
import
Gitlab
from
'
gitlab
'
;
...
...
src/db/LoginDAO.ts
View file @
4da51c60
import
{
ILogin
,
ILoginSerialized
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
ILogin
,
ILoginSerialized
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
*
as
jwt
from
'
jsonwebtoken
'
;
import
{
DATABASE_TYPE
,
USER_AUTHORIZATION
}
from
'
../Enums
'
;
import
{
staticStatistics
}
from
'
../statistics
'
;
...
...
src/db/QuizManagerDAO.ts
View file @
4da51c60
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IQuestionGroup
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IQuestionGroup
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
parseCachedAssetQuiz
}
from
'
../cache/assets
'
;
import
{
DATABASE_TYPE
}
from
'
../Enums
'
;
import
{
ActiveQuizItem
,
ActiveQuizItemPlaceholder
,
MemberGroup
}
from
'
../quiz-manager/quiz-manager
'
;
...
...
src/export/excel-workbook.ts
View file @
4da51c60
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorkbook
,
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorkbook
,
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
*
as
xlsx
from
'
excel4node
'
;
import
{
Response
}
from
'
express
'
;
import
*
as
MessageFormat
from
'
messageformat
'
;
...
...
@@ -28,9 +28,13 @@ export class ExcelWorkbook implements IExcelWorkbook {
this
.
_wb
=
new
xlsx
.
Workbook
({
jszip
:
{
compression
:
'
DEFLATE
'
,
},
defaultFont
:
{
size
:
12
,
name
:
'
Calibri
'
,
color
:
'
FF000000
'
,
},
dateFormat
:
'
d.m.yyyy
'
,
},
defaultFont
:
{
size
:
12
,
name
:
'
Calibri
'
,
color
:
'
FF000000
'
,
},
dateFormat
:
'
d.m.yyyy
'
,
});
this
.
_theme
=
new
ExcelTheme
(
themeName
);
this
.
_translation
=
translation
;
...
...
@@ -50,7 +54,11 @@ export class ExcelWorkbook implements IExcelWorkbook {
private
generateSheets
():
void
{
const
worksheetOptions
:
any
=
{
wb
:
this
.
_wb
,
theme
:
this
.
_theme
,
translation
:
this
.
_translation
,
quiz
:
this
.
_quiz
,
mf
:
this
.
_mf
,
wb
:
this
.
_wb
,
theme
:
this
.
_theme
,
translation
:
this
.
_translation
,
quiz
:
this
.
_quiz
,
mf
:
this
.
_mf
,
};
this
.
_worksheets
.
push
(
new
SummaryExcelWorksheet
(
worksheetOptions
));
...
...
src/export/excel-worksheet-choice-multiple.ts
View file @
4da51c60
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
src
/answeroptions/interfaces
'
;
import
{
INickname
,
IQuizResponse
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
dist
/answeroptions/interfaces
'
;
import
{
INickname
,
IQuizResponse
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
ExcelWorksheet
}
from
'
./excel-worksheet
'
;
import
{
calculateNumberOfAnswers
}
from
'
./lib/excel_function_library
'
;
...
...
src/export/excel-worksheet-choice-single.ts
View file @
4da51c60
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
src
/answeroptions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IAnswerOption
}
from
'
arsnova-click-v2-types/
dist
/answeroptions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
ExcelWorksheet
}
from
'
./excel-worksheet
'
;
import
{
calculateNumberOfAnswers
}
from
'
./lib/excel_function_library
'
;
...
...
src/export/excel-worksheet-freetext.ts
View file @
4da51c60
import
{
IFreetextAnswerOption
}
from
'
arsnova-click-v2-types/
src
/answeroptions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IFreetextAnswerOption
}
from
'
arsnova-click-v2-types/
dist
/answeroptions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
ExcelWorksheet
}
from
'
./excel-worksheet
'
;
export
class
FreeTextExcelWorksheet
extends
ExcelWorksheet
implements
IExcelWorksheet
{
...
...
@@ -15,7 +15,13 @@ export class FreeTextExcelWorksheet extends ExcelWorksheet implements IExcelWork
});
constructor
({
wb
,
theme
,
translation
,
quiz
,
mf
,
questionIndex
})
{
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
});
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
,
});
this
.
_ws
=
wb
.
addWorksheet
(
`
${
mf
(
'
export.question
'
)}
${
questionIndex
+
1
}
`
,
this
.
_options
);
this
.
_questionIndex
=
questionIndex
;
this
.
_question
=
this
.
quiz
.
originalObject
.
questionList
[
questionIndex
];
...
...
@@ -50,13 +56,17 @@ export class FreeTextExcelWorksheet extends ExcelWorksheet implements IExcelWork
this
.
ws
.
cell
(
4
,
1
).
style
({
alignment
:
{
wrapText
:
true
,
vertical
:
'
top
'
,
wrapText
:
true
,
vertical
:
'
top
'
,
},
});
this
.
ws
.
cell
(
4
,
2
).
style
({
alignment
:
{
wrapText
:
true
,
horizontal
:
'
center
'
,
vertical
:
'
center
'
,
},
font
:
{
wrapText
:
true
,
horizontal
:
'
center
'
,
vertical
:
'
center
'
,
},
font
:
{
color
:
'
FF000000
'
,
},
});
...
...
@@ -76,19 +86,21 @@ export class FreeTextExcelWorksheet extends ExcelWorksheet implements IExcelWork
});
this
.
ws
.
row
(
10
).
filter
({
firstRow
:
10
,
firstColumn
:
1
,
lastRow
:
10
,
lastColumn
:
minColums
,
firstRow
:
10
,
firstColumn
:
1
,
lastRow
:
10
,
lastColumn
:
minColums
,
});
const
hasEntries
=
this
.
quiz
.
memberGroups
[
0
].
members
.
length
>
0
;
const
attendeeEntryRows
=
hasEntries
?
(
this
.
quiz
.
memberGroups
[
0
].
members
.
length
)
:
1
;
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
this
.
ws
.
cell
(
11
,
1
,
attendeeEntryRows
+
10
,
columnsToFormat
,
!
hasEntries
).
style
(
attendeeEntryRowStyle
);
this
.
allResponses
.
forEach
((
responseItem
,
indexInList
)
=>
{
...
...
@@ -101,7 +113,8 @@ export class FreeTextExcelWorksheet extends ExcelWorksheet implements IExcelWork
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
++
).
style
({
font
:
{
color
:
'
FFFFFFFF
'
,
},
fill
:
{
},
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
leaderboardItem
&&
leaderboardItem
.
correctQuestions
.
indexOf
(
this
.
_questionIndex
)
>
-
1
?
'
FF008000
'
:
'
FFB22222
'
,
...
...
@@ -117,7 +130,8 @@ export class FreeTextExcelWorksheet extends ExcelWorksheet implements IExcelWork
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
});
}
...
...
src/export/excel-worksheet-ranged.ts
View file @
4da51c60
import
{
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
,
IQuestionRanged
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
,
IQuestionRanged
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
ExcelWorksheet
}
from
'
./excel-worksheet
'
;
import
{
calculateNumberOfRangedAnswers
}
from
'
./lib/excel_function_library
'
;
...
...
@@ -10,7 +10,13 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
private
readonly
_questionIndex
:
number
;
constructor
({
wb
,
theme
,
translation
,
quiz
,
mf
,
questionIndex
})
{
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
});
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
,
});
this
.
_ws
=
wb
.
addWorksheet
(
`
${
mf
(
'
export.question
'
)}
${
questionIndex
+
1
}
`
,
this
.
_options
);
this
.
_questionIndex
=
questionIndex
;
this
.
_question
=
this
.
quiz
.
originalObject
.
questionList
[
questionIndex
];
...
...
@@ -22,11 +28,16 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
const
defaultStyles
=
this
.
_theme
.
getStyles
();
const
answerCellStyle
=
{
alignment
:
{
vertical
:
'
center
'
,
horizontal
:
'
center
'
,
},
font
:
{
vertical
:
'
center
'
,
horizontal
:
'
center
'
,
},
font
:
{
color
:
'
FF000000
'
,
},
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
'
FFFFE200
'
,
},
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
'
FFFFE200
'
,
},
};
let
minColums
=
3
;
...
...
@@ -56,19 +67,25 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
this
.
ws
.
cell
(
4
,
2
).
style
(
Object
.
assign
({},
answerCellStyle
,
{
border
:
{
right
:
{
style
:
'
thin
'
,
color
:
'
black
'
,
style
:
'
thin
'
,
color
:
'
black
'
,
},
},
}));
this
.
ws
.
cell
(
4
,
3
).
style
(
Object
.
assign
({},
answerCellStyle
,
{
border
:
{
right
:
{
style
:
'
thin
'
,
color
:
'
black
'
,
style
:
'
thin
'
,
color
:
'
black
'
,
},
},
font
:
{
},
font
:
{
color
:
'
FFFFFFFF
'
,
},
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
'
FF008000
'
,
},
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
'
FF008000
'
,
},
}));
this
.
ws
.
cell
(
4
,
4
).
style
(
answerCellStyle
);
...
...
@@ -113,19 +130,21 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
});
this
.
ws
.
row
(
10
).
filter
({
firstRow
:
10
,
firstColumn
:
1
,
lastRow
:
10
,
lastColumn
:
minColums
,
firstRow
:
10
,
firstColumn
:
1
,
lastRow
:
10
,
lastColumn
:
minColums
,
});
const
hasEntries
=
this
.
leaderBoardData
.
length
>
0
;
const
attendeeEntryRows
=
hasEntries
?
(
this
.
leaderBoardData
.
length
)
:
1
;
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
this
.
ws
.
cell
(
11
,
1
,
attendeeEntryRows
+
10
,
columnsToFormat
,
!
hasEntries
).
style
(
attendeeEntryRowStyle
);
this
.
leaderBoardData
.
forEach
((
leaderboardItem
,
indexInList
)
=>
{
...
...
@@ -141,16 +160,17 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
++
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
font
:
{
},
font
:
{
color
:
responseItem
.
value
===
castedQuestion
.
correctValue
||
responseItem
.
value
<
castedQuestion
.
rangeMin
||
responseItem
.
value
>
castedQuestion
.
rangeMax
?
'
FFFFFFFF
'
:
'
FF000000
'
,
},
fill
:
{
>
castedQuestion
.
rangeMax
?
'
FFFFFFFF
'
:
'
FF000000
'
,
}
,
fill
:
{
type
:
'
pattern
'
,
patternType
:
'
solid
'
,
fgColor
:
responseItem
.
value
===
castedQuestion
.
correctValue
?
'
FF008000
'
:
responseItem
.
value
<
castedQuestion
.
rangeMin
||
responseItem
.
value
>
castedQuestion
.
rangeMax
?
'
FFB22222
'
:
'
FFFFE200
'
,
||
responseItem
.
value
>
castedQuestion
.
rangeMax
?
'
FFB22222
'
:
'
FFFFE200
'
,
},
});
if
(
this
.
responsesWithConfidenceValue
.
length
>
0
)
{
...
...
@@ -163,7 +183,8 @@ export class RangedExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
});
}
...
...
src/export/excel-worksheet-summary.ts
View file @
4da51c60
import
{
ILeaderBoardItem
,
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
ILeaderBoardItem
,
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
*
as
path
from
'
path
'
;
import
{
Leaderboard
}
from
'
../leaderboard/leaderboard
'
;
import
{
staticStatistics
}
from
'
../statistics
'
;
...
...
@@ -10,7 +10,13 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
private
_isCasRequired
=
this
.
quiz
.
originalObject
.
sessionConfig
.
nicks
.
restrictToCasLogin
;
constructor
({
wb
,
theme
,
translation
,
quiz
,
mf
})
{
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
:
null
});
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
:
null
,
});
this
.
_ws
=
wb
.
addWorksheet
(
mf
(
'
export.summary
'
),
this
.
_options
);
this
.
formatSheet
();
this
.
addSheetData
();
...
...
@@ -33,7 +39,8 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
}));
this
.
ws
.
cell
(
1
,
this
.
columnsToFormat
-
1
).
style
({
alignment
:
{
horizontal
:
'
left
'
,
vertical
:
'
center
'
,
horizontal
:
'
left
'
,
vertical
:
'
center
'
,
},
});
...
...
@@ -64,7 +71,10 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
});
this
.
ws
.
row
(
12
).
filter
({
firstRow
:
12
,
firstColumn
:
1
,
lastRow
:
12
,
lastColumn
:
this
.
columnsToFormat
,
firstRow
:
12
,
firstColumn
:
1
,
lastRow
:
12
,
lastColumn
:
this
.
columnsToFormat
,
});
let
nextStartRow
=
18
;
...
...
@@ -97,12 +107,14 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
++
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
});
if
(
nextStartRow
===
18
)
{
...
...
@@ -149,12 +161,14 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
++
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
});
}
...
...
@@ -342,7 +356,11 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
const
question
:
IQuestion
=
this
.
quiz
.
originalObject
.
questionList
[
i
];
if
(
leaderBoard
.
isCorrectResponse
(
attendee
.
responses
[
i
],
question
)
===
1
)
{
if
(
!
correctResponses
[
attendee
.
name
])
{
correctResponses
[
attendee
.
name
]
=
{
responseTime
:
0
,
correctQuestions
:
[],
confidenceValue
:
0
};
correctResponses
[
attendee
.
name
]
=
{
responseTime
:
0
,
correctQuestions
:
[],
confidenceValue
:
0
,
};
}
correctResponses
[
attendee
.
name
].
responseTime
+=
<
number
>
attendee
.
responses
[
i
].
responseTime
;
correctResponses
[
attendee
.
name
].
correctQuestions
.
push
(
i
);
...
...
@@ -356,9 +374,15 @@ export class SummaryExcelWorksheet extends ExcelWorksheet implements IExcelWorks
private
addLogoImage
():
void
{
this
.
ws
.
addImage
({
path
:
path
.
join
(
staticStatistics
.
pathToAssets
,
'
images
'
,
'
logo_transparent.png
'
),
type
:
'
picture
'
,
position
:
{
type
:
'
oneCellAnchor
'
,
from
:
{
col
:
1
,
colOff
:
'
1.5mm
'
,
row
:
1
,
rowOff
:
0
,
path
:
path
.
join
(
staticStatistics
.
pathToAssets
,
'
images
'
,
'
logo_transparent.png
'
),
type
:
'
picture
'
,
position
:
{
type
:
'
oneCellAnchor
'
,
from
:
{
col
:
1
,
colOff
:
'
1.5mm
'
,
row
:
1
,
rowOff
:
0
,
},
},
});
...
...
src/export/excel-worksheet-survey.ts
View file @
4da51c60
import
{
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
src
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IExcelWorksheet
}
from
'
arsnova-click-v2-types/
dist
/excel.interfaces
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
{
ExcelWorksheet
}
from
'
./excel-worksheet
'
;
import
{
calculateNumberOfAnswers
}
from
'
./lib/excel_function_library
'
;
...
...
@@ -10,7 +10,13 @@ export class SurveyExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
private
readonly
_questionIndex
:
number
;
constructor
({
wb
,
theme
,
translation
,
quiz
,
mf
,
questionIndex
})
{
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
});
super
({
theme
,
translation
,
quiz
,
mf
,
questionIndex
,
});
this
.
_ws
=
wb
.
addWorksheet
(
`
${
this
.
mf
(
'
export.question
'
)}
${
questionIndex
+
1
}
`
,
this
.
_options
);
this
.
_questionIndex
=
questionIndex
;
this
.
_question
=
this
.
quiz
.
originalObject
.
questionList
[
questionIndex
];
...
...
@@ -32,7 +38,9 @@ export class SurveyExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
const
columnsToFormat
=
answerList
.
length
+
1
<
minColums
?
minColums
:
answerList
.
length
+
1
;
const
answerCellStyle
=
{
alignment
:
{
wrapText
:
true
,
horizontal
:
'
center
'
,
vertical
:
'
center
'
,
wrapText
:
true
,
horizontal
:
'
center
'
,
vertical
:
'
center
'
,
},
};
...
...
@@ -67,19 +75,21 @@ export class SurveyExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
});
this
.
ws
.
row
(
9
).
filter
({
firstRow
:
9
,
firstColumn
:
1
,
lastRow
:
9
,
lastColumn
:
minColums
,
firstRow
:
9
,
firstColumn
:
1
,
lastRow
:
9
,
lastColumn
:
minColums
,
});
const
hasEntries
=
this
.
quiz
.
memberGroups
[
0
].
members
.
length
>
0
;
const
attendeeEntryRows
=
hasEntries
?
(
this
.
quiz
.
memberGroups
[
0
].
members
.
length
)
:
1
;
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
const
attendeeEntryRowStyle
=
hasEntries
?
defaultStyles
.
attendeeEntryRowStyle
:
Object
.
assign
({},
defaultStyles
.
attendeeEntryRowStyle
,
{
alignment
:
{
horizontal
:
'
center
'
,
},
});
this
.
ws
.
cell
(
10
,
1
,
attendeeEntryRows
+
9
,
columnsToFormat
,
!
hasEntries
).
style
(
attendeeEntryRowStyle
);
this
.
quiz
.
memberGroups
[
0
].
members
.
forEach
((
responseItem
,
indexInList
)
=>
{
...
...
@@ -98,7 +108,8 @@ export class SurveyExcelWorksheet extends ExcelWorksheet implements IExcelWorksh
this
.
ws
.
cell
(
targetRow
,
nextColumnIndex
).
style
({
alignment
:
{
horizontal
:
'
center
'
,
},
numberFormat
:
'
#,##0;
'
,
},
numberFormat
:
'
#,##0;
'
,
});
});
}
...
...
src/export/excel-worksheet.ts
View file @
4da51c60
import
{
IActiveQuiz
,
ILeaderBoardItem
,
INickname
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IActiveQuiz
,
ILeaderBoardItem
,
INickname
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
IQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
import
*
as
xlsx
from
'
excel4node
'
;
import
*
as
MessageFormat
from
'
messageformat
'
;
import
{
Leaderboard
}
from
'
../leaderboard/leaderboard
'
;
...
...
@@ -103,7 +103,11 @@ export abstract class ExcelWorksheet {
this
.
quiz
.
memberGroups
[
0
].
members
.
forEach
(
attendee
=>
{
if
(
leaderBoard
.
isCorrectResponse
(
attendee
.
responses
[
questionIndex
],
question
)
===
1
)
{
if
(
!
correctResponses
[
attendee
.
name
])
{
correctResponses
[
attendee
.
name
]
=
{
responseTime
:
0
,
correctQuestions
:
[],
confidenceValue
:
0
};
correctResponses
[
attendee
.
name
]
=
{
responseTime
:
0
,
correctQuestions
:
[],
confidenceValue
:
0
,
};
}
correctResponses
[
attendee
.
name
].
responseTime
+=
<
number
>
attendee
.
responses
[
questionIndex
].
responseTime
;
correctResponses
[
attendee
.
name
].
correctQuestions
.
push
(
questionIndex
);
...
...
src/export/lib/excel_function_library.ts
View file @
4da51c60
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IActiveQuiz
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
export
function
calculateNumberOfAnswers
(
quiz
:
IActiveQuiz
,
questionIndex
:
number
,
answerNumber
:
number
):
number
{
let
numberOfAnswers
=
0
;
...
...
src/leaderboard/leaderboard.ts
View file @
4da51c60
import
{
IFreetextAnswerOption
}
from
'
arsnova-click-v2-types/
src
/answeroptions/interfaces
'
;
import
{
ILeaderBoardItem
,
IQuizResponse
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
FreeTextQuestion
}
from
'
arsnova-click-v2-types/
src
/questions
'
;
import
{
IQuestion
,
IQuestionChoice
,
IQuestionRanged
}
from
'
arsnova-click-v2-types/
src
/questions/interfaces
'
;
import
{
IFreetextAnswerOption
}
from
'
arsnova-click-v2-types/
dist
/answeroptions/interfaces
'
;
import
{
ILeaderBoardItem
,
IQuizResponse
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
{
FreeTextQuestion
}
from
'
arsnova-click-v2-types/
dist
/questions
'
;
import
{
IQuestion
,
IQuestionChoice
,
IQuestionRanged
}
from
'
arsnova-click-v2-types/
dist
/questions/interfaces
'
;
export
class
Leaderboard
{
public
isCorrectResponse
(
response
:
IQuizResponse
,
question
:
IQuestion
):
number
{
...
...
src/nicknames/availableNicks.ts
View file @
4da51c60
import
{
IAvailableNicks
}
from
'
arsnova-click-v2-types/
src
/common
'
;
import
{
IAvailableNicks
}
from
'
arsnova-click-v2-types/
dist
/common
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
{
staticStatistics
}
from
'
../statistics
'
;
...
...
@@ -25,7 +25,8 @@ const availableNicks: IAvailableNicks = {
'
Cinderella
'
,
'
Dagobert Duck
'
,
'
Goofy
'
,
],
'
science
'
:
[
],
'
science
'
:
[
'
Edsger Dijkstra
'
,
'
Konrad Zuse
'
,
'
Alan Turing
'
,
...
...
@@ -46,7 +47,8 @@ const availableNicks: IAvailableNicks = {
'
Charles Darwin
'
,
'
Albert Einstein
'
,
'
Euklid
'
,
],
'
fantasy
'
:
[
],
'
fantasy
'
:
[
'
Harry Potter
'
,
'
Hermione Granger
'
,
'
Ron Weasly
'
,
...
...
@@ -67,7 +69,8 @@ const availableNicks: IAvailableNicks = {
'
Ganon
'
,
'
Zelda
'
,
'
Link
'
,
],
'
literature
'
:
[
],
'
literature
'
:
[
'
George Lucas
'
,
'
J.R.R. Tolkien
'
,
'
Joanne K. Rowling
'
,
...
...
@@ -88,7 +91,8 @@ const availableNicks: IAvailableNicks = {
'
Bertolt Brecht
'
,