diff --git a/app/models/contest-attempt.js b/app/models/contest-attempt.js index 6f99a76..761f522 100644 --- a/app/models/contest-attempt.js +++ b/app/models/contest-attempt.js @@ -17,21 +17,27 @@ export default Model.extend({ }), monitorerData: DS.attr(), tabSwitchCount: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['tab-switch-count'] + return this.monitorerData && this.monitorerData['tab-switch-count'] || 0 }), tabSwitchTimePenaltyMinutes: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['tab-switch-count'] * 10 + return this.monitorerData && this.monitorerData['tab-switch-count'] > 3 ? (this.monitorerData['tab-switch-count'] - 3) * 10 : 0 }), windowResizeCount: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['window-resize-count'] + return this.monitorerData && this.monitorerData['window-resize-count'] || 0 }), windowResizeTimePenaltyMinutes: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['window-resize-count'] * 10 + return this.monitorerData && this.monitorerData['window-resize-count'] || 0 }), noFaceCount: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['no-face-count'] + return this.monitorerData && this.monitorerData['no-face-count'] || 0 }), noFaceTimePenaltyMinutes: Ember.computed('monitorerData', function() { - return this.monitorerData && this.monitorerData['no-face-count'] * 10 + return this.monitorerData && this.monitorerData['no-face-count'] > 3 ? (this.monitorerData['no-face-count'] - 3) * 10 : 0 + }), + multipleFacesCount: Ember.computed('monitorerData', function() { + return this.monitorerData && this.monitorerData['multiple-faces-count'] || 0 + }), + multipleFacesTimePenaltyMinutes: Ember.computed('monitorerData', function() { + return this.monitorerData && this.monitorerData['multiple-faces-count'] > 3 ? (this.monitorerData['multiple-faces-count'] - 3) * 10 : 0 }), }); diff --git a/app/models/contest.js b/app/models/contest.js index 1500296..7c6a0c2 100644 --- a/app/models/contest.js +++ b/app/models/contest.js @@ -64,4 +64,7 @@ export default Model.extend({ disallowTabSwitch: DS.attr(), disallowWindowResize: DS.attr(), disallowNoFace: DS.attr(), + disallowMultipleFaces: DS.attr(), + disallowNoise: DS.attr(), + enforceFullscreen: DS.attr(), }); diff --git a/app/pods/components/full-screen-contest-view/component.js b/app/pods/components/full-screen-contest-view/component.js index 22fcf6e..5d06c65 100644 --- a/app/pods/components/full-screen-contest-view/component.js +++ b/app/pods/components/full-screen-contest-view/component.js @@ -1,5 +1,7 @@ import Component from '@ember/component'; +import ENV from 'hackerblocks/config/environment'; import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; export default class FullScreenContestView extends Component { @service monitorer @@ -9,4 +11,25 @@ export default class FullScreenContestView extends Component { this._super(...arguments) this.setupMonitorer() } + + async didInsertElement() { + // await this.ajax.request(ENV.apiHost + '/time') + // if(this.contest.enforceFullscreen) { + // const fullScreenContestViewElement = document.getElementById('fullsceen-contest-view') + // if (fullScreenContestViewElement.requestFullscreen) { + // fullScreenContestViewElement.requestFullscreen.call(fullScreenContestViewElement) + // } else if (fullScreenContestViewElement.webkitRequestFullscreen) { /* Safari */ + // fullScreenContestViewElement.webkitRequestFullscreen(); + // } else if (fullScreenContestViewElement.msRequestFullscreen) { /* IE11 */ + // fullScreenContestViewElement.msRequestFullscreen(); + // } + // } + } + + re + + @action + resetFaultMessages() { + this.monitorer.resetFaultMessages() + } } diff --git a/app/pods/components/full-screen-contest-view/template.hbs b/app/pods/components/full-screen-contest-view/template.hbs index 6ce2b57..0826e9e 100644 --- a/app/pods/components/full-screen-contest-view/template.hbs +++ b/app/pods/components/full-screen-contest-view/template.hbs @@ -1,4 +1,4 @@ -