Fix TimeStamp Report

This commit is contained in:
Suphonchai Phoonsawat 2024-08-30 14:05:58 +07:00 committed by Bright
parent 67f6be635c
commit b3c752d2e6
3 changed files with 24 additions and 18 deletions

View file

@ -1,12 +1,9 @@
name: release-dev
run-name: release-dev ${{ github.actor }}
on:
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
# tags-ignore:
# - '2.*'
# Allow run workflow manually from Action tab
push:
tags:
- "consumer-[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
env:
REGISTRY: docker.frappet.com
@ -24,11 +21,15 @@ jobs:
steps:
- uses: actions/checkout@v3
# skip Set up QEMU because it fail on act and container
# Gen Version try to get version from tag or inut
- name: Set output tags
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Gen Version
id: gen_ver
run: |
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
IMAGE_VER=${{ steps.vars.outputs.tag }}
else
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
fi
@ -36,10 +37,11 @@ jobs:
IMAGE_VER='test-vBeta'
fi
echo '::set-output name=image_ver::'$IMAGE_VER
- name: Test Version
- name: Check Version
run: |
echo $GITHUB_REF
echo ${{ steps.gen_ver.outputs.image_ver }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login in to registry
@ -48,7 +50,7 @@ jobs:
registry: ${{env.REGISTRY}}
username: ${{secrets.DOCKER_USER}}
password: ${{secrets.DOCKER_PASS}}
- name: Build and load local docker image
- name: Build and push docker image
uses: docker/build-push-action@v3
with:
context: .
@ -56,14 +58,13 @@ jobs:
file: BMA.EHR.CheckInConsumer/Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
- name: Reload docker compose
- name: Remote Deployment
uses: appleboy/ssh-action@v0.1.8
with:
host: ${{env.DEPLOY_HOST}}
username: frappet
password: ${{ secrets.SSH_PASSWORD }}
port: ${{env.DEPLOY_PORT}}
port: 10102
script: |
cd "${{env.COMPOSE_PATH}}"
docker compose pull
@ -72,18 +73,18 @@ jobs:
- uses: snow-actions/line-notify@v1.1.0
if: success()
with:
access_token: ${{ env.TOKEN_LINE }}
access_token: ${{ secrets.TOKEN_LINE }}
message: |
-Success✅✅✅
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}
- uses: snow-actions/line-notify@v1.1.0
if: failure()
with:
access_token: ${{ env.TOKEN_LINE }}
access_token: ${{ secrets.TOKEN_LINE }}
message: |
-Failure❌❌❌
Image: ${{env.IMAGE_NAME}}
Version: ${{ github.event.inputs.IMAGE_VER }}
Version: ${{ steps.gen_ver.outputs.IMAGE_VER }}
By: ${{secrets.DOCKER_USER}}

View file

@ -40,6 +40,7 @@ namespace BMA.EHR.Application.Responses.Profiles
public string? Gender { get; set; }
public string? ProfileType { get; set; }
public bool? IsLeave { get; set; }
}

View file

@ -1062,6 +1062,10 @@ namespace BMA.EHR.Leave.Service.Controllers
{
//var profile = await _userProfileRepository.SearchProfile(null, null, null);
var profile = await _userProfileRepository.GetProfileWithKeycloak(AccessToken);
if(profile.Count > 0)
{
profile = profile.Where(p => p.IsLeave == false).ToList();
}
var date = req.StartDate.Date;
var holidays = await _holidayRepository.GetHolidayAsync(req.StartDate.Date, req.EndDate.Date);
@ -1206,9 +1210,9 @@ namespace BMA.EHR.Leave.Service.Controllers
workTotal += 1;
if (!timeStamps.IsLocationCheckIn)
{
if(timeStamps.CheckInLocationName!.Contains("ปฏิบัติงานที่บ้าน"))
if(timeStamps.CheckInLocationName == "ปฏิบัติงานที่บ้าน")
wfhTotal += 1;
else if (timeStamps.CheckInLocationName!.Contains("ประชุม"))
else if (timeStamps.CheckInLocationName == "ไปประชุม/อบรม/สัมมนา/ปฏิบัติงานที่บ้านนอกสถานที่")
seminarTotal += 1;
}