Skip to content

Commit

Permalink
etc
Browse files Browse the repository at this point in the history
  • Loading branch information
onlycs committed Jan 13, 2025
1 parent c96e974 commit b691bfa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ async fn clear(req: HttpRequest, state: web::Data<AppState>) -> Result<impl Resp
sqlx::query!(
r#"
DELETE FROM records
WHERE in_progress = true
WHERE
in_progress = true or
sign_out - sign_in >= INTERVAL '8 hours'
"#
)
.execute(&*state.pg)
Expand Down
2 changes: 1 addition & 1 deletion src-api/src/routes/hours.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub async fn hours(id: String, pg: &PgPool) -> Result<(f64, f64), RouteError> {
AND sign_out IS NOT NULL
AND in_progress = false
AND EXTRACT(MONTH FROM sign_in) <= 12
AND EXTRACT(MONTH FROM sign_in) >= 11
AND EXTRACT(MONTH FROM sign_in) >= 9
"#,
id
)
Expand Down
5 changes: 0 additions & 5 deletions src-api/src/routes/roster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,10 @@ pub async fn roster(id: String, force: bool, pg: &PgPool) -> Result<RosterRespon
.await?;

if let Some(record) = record {
// get chrono utc now
let dt = Utc::now().naive_utc();
let diff = dt - record.sign_in;

println!("{:?} {:?} {:?}", dt, record.sign_in, diff);

if (diff.num_minutes() < 5) && !force {
println!("less than 5 minutes");

return Ok(RosterResponse {
is_login: false,
needs_force: true,
Expand Down

0 comments on commit b691bfa

Please sign in to comment.