Skip to content

Commit 558c177

Browse files
committed
Some Bug Fixes
1 parent c1099fd commit 558c177

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

backend/voting/static/js/voting.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ function getCookie(cname) {
2323
$(document).ready(function () {
2424

2525
$("#flipCam").click(function () {
26-
camNo = (camNo+1)%totCam;
26+
if (camNo === 0)
27+
camNo = 1;
28+
else
29+
camNo = 0;
2730
scanner.stop().then(()=>{startCam();});
2831
})
2932

@@ -126,7 +129,6 @@ var arrPhoto = [];
126129

127130
var scanner;
128131
var camNo = -1;
129-
var totCam;
130132

131133
function startCam() {
132134
scanner = new Instascan.Scanner({
@@ -135,7 +137,6 @@ function startCam() {
135137
})
136138
Instascan.Camera.getCameras().then(function (cameras) {
137139
if (camNo === -1) {
138-
totCam = cameras.length;
139140
if (cameras.length > 1) {
140141
camNo = 1;
141142
} else if (cameras.length > 0) {

backend/voting/templates/voting/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
function barcode(code) {
4747
var bool = false;
4848

49-
if ((code[0].match(/[a-z]/i) && code[2].match(/[a-z]/i) && code.length === 11) || (code.length === 4 && Number.isInteger(code) )) {
49+
if (code[0].match(/[a-z]/i) && code[2].match(/[a-z]/i) && code.length === 11 || (code.length === 4 && Number.isInteger(code[0]) && Number.isInteger(code[1]) && Number.isInteger(code[2]) && Number.isInteger(code[3])) ) {
5050
console.log(code);
5151
// start loading a(if possible pause video)
5252
$(".loading").show();

0 commit comments

Comments
 (0)