diff --git a/app/models/contest-attempt.js b/app/models/contest-attempt.js
index 6509eda..d90c254 100644
--- a/app/models/contest-attempt.js
+++ b/app/models/contest-attempt.js
@@ -28,6 +28,12 @@ export default Model.extend({
windowResizeTimePenaltyMinutes: Ember.computed('monitorerData', function() {
return this.monitorerData && this.monitorerData['window-resizes-penalty'] || 0
}),
+ windowMoveCount: Ember.computed('monitorerData', function() {
+ return this.monitorerData && this.monitorerData['window-move-count'] || 0
+ }),
+ windowMoveTimePenaltyMinutes: Ember.computed('monitorerData', function() {
+ return this.monitorerData && this.monitorerData['window-moves-penalty'] || 0
+ }),
noFaceCount: Ember.computed('monitorerData', function() {
return this.monitorerData && this.monitorerData['no-face-count'] || 0
}),
diff --git a/app/models/contest.js b/app/models/contest.js
index f8ad85f..f850ebb 100644
--- a/app/models/contest.js
+++ b/app/models/contest.js
@@ -63,6 +63,7 @@ export default Model.extend({
allowPaste: DS.attr(),
disallowTabSwitch: DS.attr(),
disallowWindowResize: DS.attr(),
+ disallowWindowMove: DS.attr(),
disallowNoFace: DS.attr(),
disallowMultipleFaces: DS.attr(),
disallowNoise: DS.attr(),
@@ -70,8 +71,10 @@ export default Model.extend({
allowedTabSwitchesNumber: DS.attr(),
allowedNoFacesNumber: DS.attr(),
allowedMultipleFacesNumber: DS.attr(),
+ allowedWindowMovesNumber: DS.attr(),
tabSwitchPenalty: DS.attr(),
noFacePenalty: DS.attr(),
multipleFacesPenalty: DS.attr(),
- windowResizePenalty: DS.attr()
+ windowResizePenalty: DS.attr(),
+ windowMovePenalty: DS.attr()
});
diff --git a/app/pods/components/full-screen-contest-view/template.hbs b/app/pods/components/full-screen-contest-view/template.hbs
index 2b401c4..d082463 100644
--- a/app/pods/components/full-screen-contest-view/template.hbs
+++ b/app/pods/components/full-screen-contest-view/template.hbs
@@ -175,6 +175,14 @@
{{contest.windowResizePenalty}} minutes deducted.
{{/if}}
+
+ {{#if monitorer.faultMessages.windowMove}}
+ You moved browser window {{attempt.windowMoveCount}} {{if (eq attempt.windowMoveCount 1) 'time' 'times'}}.
+ {{#if (gPt attempt.windowMoveCount contest.allowedWindowMovesNumber)}}
+ {{contest.windowMovePenalty}} minutes deducted.
+ {{/if }}
+ {{/if}}
+
{{#if monitorer.faultMessages.noise}}
Noise detected.
@@ -191,6 +199,10 @@
Total Window Resizes: {{attempt.windowResizeCount}} | {{attempt.windowResizeTimePenaltyMinutes}} mins deducted
{{/if}}
+ {{#if contest.disallowWindowMove}}
+ Total Window Moves: {{attempt.windowMoveCount}} | {{attempt.windowMoveTimePenaltyMinutes}} mins deducted
+ {{/if}}
+
{{#if contest.disallowNoFace}}
Total Face Undetected: {{attempt.noFaceCount}} | {{attempt.noFaceTimePenaltyMinutes}} mins deducted
{{/if}}
diff --git a/app/pods/components/intermediate-contest-view/template.hbs b/app/pods/components/intermediate-contest-view/template.hbs
index 9206669..ba85095 100644
--- a/app/pods/components/intermediate-contest-view/template.hbs
+++ b/app/pods/components/intermediate-contest-view/template.hbs
@@ -105,6 +105,12 @@
• Resize the browser window
{{/if}}
+ {{#if contest.disallowWindowMove}}
+ Browser Window Movement is prohibited on this contest. You will face a penalty of 10 mins every 10 secs in case you :-
+
+ - • Move the browser window
+
+ {{/if}}
{{#if contest.disallowNoFace}}
Face detection is enabled on this contest. You will face a penalty of 10 mins every 5 secs after 3 faults in case :-
diff --git a/app/services/monitorer.js b/app/services/monitorer.js
index 319031d..b55acc6 100644
--- a/app/services/monitorer.js
+++ b/app/services/monitorer.js
@@ -23,6 +23,7 @@ export default Service.extend({
noFace: false,
multipleFaces: false,
windowResize: false,
+ windowMove: false,
noise: false
},
init() {
@@ -59,6 +60,10 @@ export default Service.extend({
await this.enableWindowResizeMonitorer()
}
+ if(this.contest.disallowWindowMove) {
+ await this.enableWindowMoveMonitorer()
+ }
+
if(this.contest.disallowNoFace) {
await this.enableNoFaceMonitorer()
}
@@ -77,6 +82,7 @@ export default Service.extend({
// this.set('onError', null)
await this.disableTabSwitchMonitorer()
await this.disableWindowResizeMonitorer()
+ await this.disableWindowMoveMonitorer()
await this.disableNoFaceMonitorer()
await this.disableMultipleFacesMonitorer()
@@ -91,6 +97,10 @@ export default Service.extend({
await this.monitorer.enable({ windowResize: true })
},
+ async enableWindowMoveMonitorer() {
+ await this.monitorer.enable({ windowMove: true })
+ },
+
async enableNoFaceMonitorer() {
await this.monitorer.enable({ noFace: true })
if(!this.isLiveFeedEnabled) {
@@ -126,6 +136,10 @@ export default Service.extend({
async disableWindowResizeMonitorer() {
await this.monitorer.disable({ windowResize: true })
},
+
+ async disableWindowMoveMonitorer() {
+ await this.monitorer.disable({ windowMove: true })
+ },
async disableNoFaceMonitorer() {
await this.monitorer.disable({ noFace: true })
@@ -158,10 +172,11 @@ export default Service.extend({
async monitorerFaultEventHandler(e) {
const currentAttempt = await this.contest.currentAttempt
if(!!!currentAttempt.id) return
-
+
switch(e.detail.code) {
case "TAB_SWITCHED": await this.handleTabSwitchFault(); break;
case "WINDOW_RESIZED": await this.handleWindowResizeFault(e.detail); break;
+ case "WINDOW_MOVED": await this.handleWindowMoveFault(); break;
case "NO_FACE_DETECTED": await this.handleNoFaceFault(e.detail);
this.set('oneFaceDetected', false); break;
case "MULTIPLE_FACES_DETECTED": await this.handleMultipleFacesFault(e.detail);
@@ -216,6 +231,20 @@ export default Service.extend({
await this.store.findRecord('contest-attempt', currentAttempt.id)
}
},
+ async handleWindowMoveFault(details) {
+ this.set('faultMessages.windowMove', true)
+ this.set('faultTrigger', true)
+
+ const currentAttempt = await this.contest.currentAttempt
+ await this.api.request(`/contest-attempts/${currentAttempt.id}/report-monitorer-fault`, {
+ method: 'POST',
+ data: {
+ fault_type: 'window_move'
+ }
+ })
+ await this.store.findRecord('contest-attempt', currentAttempt.id)
+
+ },
async handleNoFaceFault(details) {
if(!this.noFaceThrottled) {