Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sam
website
Commits
c237d6b9
Commit
c237d6b9
authored
6 years ago
by
Hakkel Tamás
Browse files
Options
Downloads
Patches
Plain Diff
photos time-precision bugfix, reintroduction of location-based burst detection
parent
9255a112
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
photos/backend.php
+22
-7
22 additions, 7 deletions
photos/backend.php
photos/index.js
+1
-1
1 addition, 1 deletion
photos/index.js
with
23 additions
and
8 deletions
photos/backend.php
+
22
−
7
View file @
c237d6b9
...
...
@@ -9,10 +9,10 @@ else
// Once the page is loaded, we do not want to send already loaded images
if
(
isset
(
$_POST
[
'last_timestamp'
]))
{
$last_timestamp
=
(
float
)
$_POST
[
'last_timestamp'
];
$last_timestamp
=
$_POST
[
'last_timestamp'
];
$limit
=
100
;
}
else
{
$last_timestamp
=
time
()
*
1000
;
$last_timestamp
=
bcmul
(
time
()
,
1000
)
;
$limit
=
500
;
}
...
...
@@ -49,11 +49,10 @@ if (isset($_POST['accepted']) OR isset($_POST['rejected'])) {
// Query for images
$query
=
'
SELECT photo_ID,timestamp
SELECT photo_ID,timestamp
, xmin, ymin, xmax, ymax
FROM photo JOIN user USING(card_ID)
WHERE shibboleth=:shibboleth
AND is_it_sure = '
.
(
isset
(
$_POST
[
'page'
])
&&
$_POST
[
'page'
]
===
'unverified'
?
0
:
1
)
.
'
AND is_it_sure = '
.
(
$_POST
[
'page'
]
===
'unverified'
?
'0'
:
'1'
)
.
'
AND timestamp < :last_timestamp
ORDER BY timestamp DESC
LIMIT '
.
$limit
;
...
...
@@ -68,19 +67,35 @@ class Burst {
var
$first_timestamp
;
var
$last_timestamp
;
var
$items
=
array
();
var
$grouping_time
=
3000
;
var
$grouping_time
=
1500
;
var
$xmin
,
$ymin
,
$xmax
,
$ymax
;
function
__construct
(
$new_item
)
{
$this
->
first_timestamp
=
$new_item
[
'timestamp'
];
$this
->
xmin
=
$new_item
[
'xmin'
];
$this
->
ymin
=
$new_item
[
'ymin'
];
$this
->
xmax
=
$new_item
[
'xmax'
];
$this
->
ymax
=
$new_item
[
'ymax'
];
$this
->
add
(
$new_item
);
}
function
check
(
$new_item
)
{
return
$new_item
[
'timestamp'
]
-
$this
->
last_timestamp
<
$this
->
grouping_time
;
$new_x_middle
=
(
$new_item
[
'xmin'
]
+
$new_item
[
'xmax'
])
/
2
;
$new_y_middle
=
(
$new_item
[
'ymin'
]
+
$new_item
[
'ymax'
])
/
2
;
$width
=
$new_item
[
'xmax'
]
-
$new_item
[
'xmin'
];
$height
=
$new_item
[
'ymax'
]
-
$new_item
[
'ymin'
];
return
$this
->
last_timestamp
-
$new_item
[
'timestamp'
]
<
$this
->
grouping_time
AND
$this
->
xmin
-
$width
*.
5
<
$new_x_middle
AND
$new_x_middle
<
$this
->
xmax
+
$width
*.
5
AND
$this
->
ymin
<
$new_y_middle
AND
$new_y_middle
<
$this
->
ymax
;
}
function
add
(
$new_item
)
{
$this
->
last_timestamp
=
$new_item
[
'timestamp'
];
$this
->
xmin
=
$new_item
[
'xmin'
];
$this
->
ymin
=
$new_item
[
'ymin'
];
$this
->
xmax
=
$new_item
[
'xmax'
];
$this
->
ymax
=
$new_item
[
'ymax'
];
array_push
(
$this
->
items
,
$new_item
[
'photo_ID'
]);
}
...
...
This diff is collapsed.
Click to expand it.
photos/index.js
+
1
−
1
View file @
c237d6b9
...
...
@@ -31,7 +31,7 @@ function receivePhotos(data) {
var
photos
=
parsed
[
'
photos
'
];
last_timestamp
=
parsed
[
'
last_timestamp
'
];
var
div
=
$
(
document
.
createElement
(
'
div
'
));
for
(
var
date
of
Object
.
keys
(
photos
)
.
reverse
()
)
{
for
(
var
date
of
Object
.
keys
(
photos
))
{
var
group_template
=
$
(
"
#img-group-template > div
"
).
clone
(
true
);
group_template
.
find
(
"
p
"
).
text
(
parseTimestamp
(
date
));
group_template
.
find
(
"
a
"
).
attr
(
"
data-group
"
,
date
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment