diff --git a/src/adonisjs/public/hradm/users-csv/example-users.csv b/src/adonisjs/public/hradm/users-csv/example-users.csv
new file mode 100644
index 00000000..27d50874
--- /dev/null
+++ b/src/adonisjs/public/hradm/users-csv/example-users.csv
@@ -0,0 +1,2 @@
+"name","email"
+"Full name","email"
\ No newline at end of file
diff --git a/src/adonisjs/public/infra/conditional-layout.js b/src/adonisjs/public/infra/conditional-layout.js
index 522e04d9..aa55b28d 100644
--- a/src/adonisjs/public/infra/conditional-layout.js
+++ b/src/adonisjs/public/infra/conditional-layout.js
@@ -7,6 +7,7 @@ class LayoutController {
this.prognosisAvatar = this.prognosisAvatar.bind(this)
MessageBus.i.subscribe('control/html/ready', this.prognosisAvatar)
// this.startController()
+ this._pocusUniversities = ['hcpa','unisinos','hcusp', 'uni']
}
set case (newValue) {
@@ -113,7 +114,7 @@ class LayoutController {
async dynamicAuthor (){
if(LayoutController.case.message.category_id === 'pocus-training'
- && (LayoutController.user.message.institution === 'hcpa' || LayoutController.user.message.institution === 'unisinos')){
+ && this._pocusUniversities.includes(LayoutController.user.message.institution)){
const toolbarDiv = document.querySelector('#div-toolbar-rightside')
toolbarDiv.innerHTML =
`
FEEDBACK:
@@ -248,7 +249,7 @@ class LayoutController {
async dynamicMenu (){
- if((LayoutController.user.message.institution === 'hcpa' || LayoutController.user.message.institution === 'unisinos')
+ if(this._pocusUniversities.includes(LayoutController.user.message.institution)
&& document.querySelector('#home-btn-container')){
const btnContainer = document.querySelector('#home-btn-container')
const btnFeedback = document.createElement('template')
diff --git a/src/adonisjs/public/report/category/cases/play/index-celular-space.html b/src/adonisjs/public/report/category/cases/play/index-celular-space.html
new file mode 100644
index 00000000..2ffe3d10
--- /dev/null
+++ b/src/adonisjs/public/report/category/cases/play/index-celular-space.html
@@ -0,0 +1,156 @@
+
+
+
+
+ Report Play
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Schema: list of fields to be retrieved
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/adonisjs/public/report/category/cases/play/schemas/mutant-cell-post.csv b/src/adonisjs/public/report/category/cases/play/schemas/mutant-cell-post.csv
new file mode 100644
index 00000000..70743dde
--- /dev/null
+++ b/src/adonisjs/public/report/category/cases/play/schemas/mutant-cell-post.csv
@@ -0,0 +1 @@
+Perguntas_2.q1,Perguntas_2.q2,Perguntas_2.q3,Perguntas_2.q4,Perguntas_2.q5
\ No newline at end of file
diff --git a/src/adonisjs/public/report/category/cases/play/schemas/mutant-cell.csv b/src/adonisjs/public/report/category/cases/play/schemas/mutant-cell-pre.csv
similarity index 100%
rename from src/adonisjs/public/report/category/cases/play/schemas/mutant-cell.csv
rename to src/adonisjs/public/report/category/cases/play/schemas/mutant-cell-pre.csv
diff --git a/src/adonisjs/public/report/js/report-cell-space.js b/src/adonisjs/public/report/js/report-cell-space.js
new file mode 100644
index 00000000..0b1e2e93
--- /dev/null
+++ b/src/adonisjs/public/report/js/report-cell-space.js
@@ -0,0 +1,253 @@
+class ReportManager {
+ start () {
+ this._report = this._report.bind(this)
+ MessageBus.i.subscribe('report/update', this._report)
+ this._download = this._download.bind(this)
+ MessageBus.i.subscribe('report/download', this._download)
+ MessageBus.i.subscribe('table/updated', this._updateCSV.bind(this))
+ }
+
+ async _requestLogger () {
+ const logger = await MessageBus.i.request('logger/list/get',
+ {caseId: new URL(document.location).searchParams.get('id'),
+ startingDateTime: new URL(document.location).searchParams.get('start'),
+ endingDateTime: new URL(document.location).searchParams.get('end')})
+ if (logger.message.error) {
+ console.log('--- error')
+ console.log(logger.message.error)
+ return null
+ } else
+ return logger
+ }
+
+ _updateCSV (topic, message) {
+ console.log('===== CSV received')
+ console.log(message.table.schema)
+ this._schema = message.table.schema
+ }
+
+ async _download () {
+ const zeroPad = (num) => String(num).padStart(2, '0')
+
+ const logger = await this._requestLogger()
+
+ if (logger != null) {
+ const schema = this._schema
+ let table = '"user id","user","start","date"'
+ for (const s of schema)
+ table += ',"' + s + '","time","miliseconds"'
+ table += '\n'
+ for (const l of logger.message.logs) {
+ const answers = JSON.parse(l.log)
+ const track = this._prepareTrack(answers.knotTrack, answers.varTrack)
+ let lastTime = new Date(track.timeStart)
+ table += '"' + l.user_id + '","' + l.username + '","' +
+ track.timeStart + '","' +
+ zeroPad(lastTime.getDate()) + '/' +
+ zeroPad(lastTime.getMonth() + 1) + '/' +
+ zeroPad(lastTime.getFullYear()) + '"'
+ for (const s of schema) {
+ let time = -1
+ if (track[s] != null) {
+ const t = new Date(track[s])
+ time = new Date(t - lastTime)
+ lastTime = t
+ }
+ console.log('=== variable ' + s)
+ console.log(answers.variables[s])
+ table += ',"' +
+ (answers.variables[s] == null
+ ? ''
+ : (typeof answers.variables[s] === 'string' || answers.variables[s] instanceof String)
+ ? answers.variables[s].replace(/"/g, '""')
+ : answers.variables[s]
+ ) +
+ '","' + (time == -1 ? ''
+ : zeroPad(time.getMinutes()) + ':' +
+ zeroPad(time.getSeconds())) + '","' +
+ ((time == -1) ? '' : time.getTime()) + '"'
+ }
+ table += '\n'
+ }
+
+ const element = document.createElement('a')
+ element.setAttribute('href',
+ 'data:text/plain;charset=utf-8,' + encodeURIComponent(table))
+ element.setAttribute('download', 'log.csv')
+ element.style.display = 'none'
+ document.body.appendChild(element)
+ element.click()
+ document.body.removeChild(element)
+ }
+ }
+
+ async _report () {
+ const reportArea = document.querySelector('#report-area')
+ const logger = await this._requestLogger()
+
+ if (logger != null) {
+ const logs = {}
+ for (const l of logger.message.logs)
+ logs[l.id] = l
+
+ let html = '' +
+ 'user ' +
+ 'date/hour ' +
+ 'answers ' +
+ ' '
+ const checked = document.getElementsByClassName('form-check-input')
+ for (const c of checked) {
+ if (c.checked) {
+ const answers = JSON.parse(logs[c.value].log)
+ const track = this._prepareTrack(answers.knotTrack, answers.varTrack)
+ html += '' +
+ logs[c.value].username +
+ ' ' +
+ track.timeStart + ' to ' + logs[c.value].created_at +
+ ' ' +
+ '' +
+ this._presentVariables(answers.variables, track) +
+ this._presentVarTrack(answers.varTrack, track) +
+ '
'
+ }
+ }
+ html += '
'
+ html += `
+
+
+
+
+ `
+
+ document.querySelector('#report-area').innerHTML = html
+ }
+ }
+
+ _prepareTrack (knotTrack, varTrack) {
+ const track = {timeStart: knotTrack[0].timeStart}
+ for (const v of varTrack) {
+ const changed = v.changed
+ for (const t in v)
+ if (t != 'changed' && !track[v[t]])
+ track[t] = changed
+ }
+ return track
+ }
+
+ _presentVariables (variables, track) {
+ let html = ''
+ let levels = []
+ let max = 1
+ for (const v in variables) {
+ // if (v == 'space_state') {
+ let lv = v.split('.')
+ html += ''
+ for (const l in lv) {
+ if (levels[l] && levels[l] == lv[l]) {
+ html += ' '
+ } else {
+ html += '' + lv[l] + ' '
+ levels = lv.slice(0, l)
+ }
+ if (l == lv.length-1)
+ html += '' +
+ track[v] + ' ' +
+ '' +
+ ((v != 'space_state') ? '' :
+ '') +
+ // this._presentValue(variables[v]) +
+ variables[v] +
+ ((v != 'space_state') ? '' :
+ ' ') +
+ ' '
+ }
+ html += ' '
+ // }
+ }
+ return html
+ }
+
+ _presentVarTrack (varTrack, track) {
+ let html = ''
+ let levels = []
+ let max = 1
+ for (const v of varTrack) {
+ let variable = ''
+ for (const l in v) {
+ if (l != 'changed')
+ variable = l
+ }
+ console.log('variable')
+ console.log(variable)
+ // if (v['space_state']) {
+ html += ''
+ html += '' + variable + ' ' +
+ '' +
+ v['changed'] +
+ ' ' +
+ '' +
+ ((variable != 'space_state') ? '' :
+ '') +
+ v[variable] +
+ ((variable != 'space_state') ? '' :
+ ' ') +
+ ' '
+ html += ' '
+ // }
+ }
+ return html
+ }
+
+ _presentValue (value) {
+ let html = ''
+ if (Array.isArray(value)) {
+ if ((typeof value[0] === 'string' || value[0] instanceof String) &&
+ (value[0].endsWith(':false') || value[0].endsWith(':true'))) {
+ let result = ''
+ html += ''
+ for (const a in value) {
+ const v = value[a].substring(value[a].lastIndexOf(':') + 1)
+ html += '' +
+ value[a].substring(0, value[a].lastIndexOf(':')) +
+ ' ' + v + ' '
+ }
+ html += '
'
+ } else {
+ if (isNaN(value[0])) {
+ html += ''
+ for (const a in value)
+ html += '' +
+ this._presentValue(value[a]) + ' '
+ html += '
'
+ } else {
+ html += '['
+ for (const a in value)
+ html += value[a] + ((a < value.length-1) ? ',' : '')
+ html += ']'
+ }
+ }
+ } else if (typeof value === 'object') {
+ html += ''
+ for (const o in value)
+ html += '' + o + ': ' +
+ '' +
+ this._presentValue(value[o]) + ' '
+ html += '
'
+ } else if ((typeof value === 'string' || value instanceof String) &&
+ (value.endsWith(':false') || value.endsWith(':true'))) {
+ const v = value.substring(value.lastIndexOf(':') + 1)
+ html = '' +
+ value.substring(0, value.lastIndexOf(':')) +
+ ' ' + v + ' ' +
+ '
'
+ } else
+ html = ('' + value).replace(/\n/g, ' ')
+ return html
+ }
+}
+
+(function () {
+ ReportManager.i = new ReportManager()
+})()
diff --git a/src/adonisjs/public/report/js/report.js b/src/adonisjs/public/report/js/report.js
index 0adc1cec..dbd51506 100644
--- a/src/adonisjs/public/report/js/report.js
+++ b/src/adonisjs/public/report/js/report.js
@@ -46,18 +46,22 @@ class ReportManager {
zeroPad(lastTime.getDate()) + '/' +
zeroPad(lastTime.getMonth() + 1) + '/' +
zeroPad(lastTime.getFullYear()) + '"'
- console.log(track)
- console.log(schema)
for (const s of schema) {
- console.log(track[s])
let time = -1
if (track[s] != null) {
const t = new Date(track[s])
time = new Date(t - lastTime)
lastTime = t
}
- table += ',"' + (answers.variables[s] == null ? ''
- : answers.variables[s].replace(/"/g, '""')) +
+ console.log('=== variable ' + s)
+ console.log(answers.variables[s])
+ table += ',"' +
+ (answers.variables[s] == null
+ ? ''
+ : (typeof answers.variables[s] === 'string' || answers.variables[s] instanceof String)
+ ? answers.variables[s].replace(/"/g, '""')
+ : answers.variables[s]
+ ) +
'","' + (time == -1 ? ''
: zeroPad(time.getMinutes()) + ':' +
zeroPad(time.getSeconds())) + '","' +
diff --git a/src/adonisjs/public/user/js/user-signup.js b/src/adonisjs/public/user/js/user-signup.js
index adfdd008..cce20c42 100644
--- a/src/adonisjs/public/user/js/user-signup.js
+++ b/src/adonisjs/public/user/js/user-signup.js
@@ -329,7 +329,8 @@ class UserSignup {
}
let user = await MessageBus.i.request('user/login/post', userLogin)
// window.location.href = "/player/case/?id=41813d6c-70c7-4bda-9683-1dd39ba3c990&room=c6b241ee-e6e5-4921-9cc8-ed6ffd62e85d"
- window.location.href = "/player/case/?id=46d46199-a32d-42ed-b49a-578c47c3e7bb&room=5ff12575-0d4c-41f6-ac6a-e94ee1eb7cbc"
+ // window.location.href = "/player/case/?id=46d46199-a32d-42ed-b49a-578c47c3e7bb&room=5ff12575-0d4c-41f6-ac6a-e94ee1eb7cbc"
+ window.location.href = "/player/case/?id=cc2ba189-3a9a-465b-8011-579cbf1bf42c&room=5ff12575-0d4c-41f6-ac6a-e94ee1eb7cbc"
}
async _experimentStartAdultMuseum () {