Skip to content

Commit

Permalink
Merge pull request #2233 from bcgov/1.10.9
Browse files Browse the repository at this point in the history
1.10.9
  • Loading branch information
bcgov-brwang authored Apr 4, 2024
2 parents c591e69 + 7917639 commit 17427e1
Show file tree
Hide file tree
Showing 235 changed files with 14,486 additions and 5,271 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"bcgov_hets" /o:"bcgov-sonarcloud" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"bcgov_hets" /o:"bcgov-sonarcloud" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverage.exclusions=**\Server\**\* /d:sonar.cpd.exclusions=**\Server\**\*
dotnet build Server
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
2 changes: 1 addition & 1 deletion .pipeline/lib/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";
const options = require("@bcgov/pipeline-cli").Util.parseArguments();
const changeId = options.pr; //aka pull-request
const version = "1.10.1";
const version = "1.10.9";
const name = "hets";

Object.assign(options.git, { owner: "ychung-mot", repository: "hets" });
Expand Down
3 changes: 2 additions & 1 deletion .sonarcloud.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ sonar.projectName=hets

# Path to sources
sonar.sources=Server,client/src
#sonar.exclusions=
sonar.coverage.exclusions=Server/**/*
sonar.cpd.exclusions=Server/**/*
#sonar.inclusions=

# Source encoding
Expand Down
35 changes: 25 additions & 10 deletions Server/HetsApi/Controllers/DistrictController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using Hangfire.Common;
using HetsData.Dtos;
using AutoMapper;
using HetsCommon;

namespace HetsApi.Controllers
{
Expand Down Expand Up @@ -90,10 +91,15 @@ public virtual ActionResult<List<OwnerDto>> DistrictOwnersGet([FromRoute]int id)
[AllowAnonymous]
public virtual ActionResult<List<LocalAreaDto>> DistrictLocalAreasGet([FromRoute]int id)
{
var now = DateTime.UtcNow;
var nowDate = DateUtils.ConvertPacificToUtcTime(
new DateTime(now.Year, now.Month, now.Day, 0, 0, 0, DateTimeKind.Unspecified));

List<HetLocalArea> localAreas = _context.HetLocalAreas.AsNoTracking()
.Where(x => x.ServiceArea.District.DistrictId == id &&
x.StartDate <= DateTime.UtcNow.Date &&
(x.EndDate > DateTime.UtcNow.Date || x.EndDate == null))
.Where(x =>
x.ServiceArea.District.DistrictId == id
&& x.StartDate <= nowDate
&& (x.EndDate > nowDate || x.EndDate == null))
.OrderBy(x => x.Name)
.ToList();

Expand Down Expand Up @@ -126,15 +132,20 @@ public virtual ActionResult<DistrictStatusDto> RolloverStatusGet([FromRoute]int
var progress = _context.HetRolloverProgresses.FirstOrDefault(a => a.DistrictId == id);

// not found
if (progress == null) return new ObjectResult(new HetsResponse(new RolloverProgressDto { DistrictId = id, ProgressPercentage = null }));
if (progress == null)
return new ObjectResult(
new HetsResponse(
new RolloverProgressDto { DistrictId = id, ProgressPercentage = null }));

if (!jobExists)
{
return new ObjectResult(new HetsResponse(status));
}

// get status of current district
return new ObjectResult(new HetsResponse(new RolloverProgressDto { DistrictId = id, ProgressPercentage = progress.ProgressPercentage }));
return new ObjectResult(
new HetsResponse(
new RolloverProgressDto { DistrictId = id, ProgressPercentage = progress.ProgressPercentage }));
}

private string GetJobFingerprint(Hangfire.Common.Job job)
Expand Down Expand Up @@ -203,18 +214,22 @@ public virtual ActionResult<DistrictStatusDto> AnnualRolloverGet([FromRoute]int
bool exists = _context.HetDistricts.Any(a => a.DistrictId == id);

// not found
if (!exists) return new NotFoundObjectResult(new HetsResponse("HETS-01", ErrorViewModel.GetDescription("HETS-01", _configuration)));
if (!exists)
return new NotFoundObjectResult(
new HetsResponse("HETS-01", ErrorViewModel.GetDescription("HETS-01", _configuration)));

// determine the current fiscal year
DateTime fiscalStart;

if (DateTime.UtcNow.Month == 1 || DateTime.UtcNow.Month == 2 || DateTime.UtcNow.Month == 3)
DateTime now = DateTime.Now;
if (now.Month == 1 || now.Month == 2 || now.Month == 3)
{
fiscalStart = new DateTime(DateTime.UtcNow.AddYears(-1).Year, 4, 1);
fiscalStart = DateUtils.ConvertPacificToUtcTime(
new DateTime(now.AddYears(-1).Year, 4, 1, 0, 0, 0, DateTimeKind.Unspecified));
}
else
{
fiscalStart = new DateTime(DateTime.UtcNow.Year, 4, 1);
fiscalStart = DateUtils.ConvertPacificToUtcTime(
new DateTime(now.Year, 4, 1, 0, 0, 0, DateTimeKind.Unspecified));
}

// get record and ensure it isn't already processing
Expand Down
Loading

0 comments on commit 17427e1

Please sign in to comment.