Skip to content

Commit

Permalink
Merge branch 'main' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
micnori committed Nov 6, 2024
2 parents 0eb039a + e05f0cb commit 6b8beca
Show file tree
Hide file tree
Showing 42 changed files with 3,561 additions and 458 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
.vscode/
.vscode/
.idea
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/sco.pgaziendale-test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public ResponseEntity<ProfileDTO> getProfile(@PathVariable String campaign) {
&& r.getSubscriptions().stream().anyMatch(s -> s.getCampaign().equals(campaign) && !s.isAbandoned())).findAny().orElse(null);
if (role != null) {
logger.info("User role " + role.getSubscriptions());
Subscription sub = role.getSubscriptions().stream().filter(s -> s.getCampaign().equals(campaign)).findAny().orElse(null);
Subscription sub = role.getSubscriptions().stream().filter(s -> s.getCampaign().equals(campaign) && !s.isAbandoned()).findAny().orElse(null);
Company company = companyService.findByCode(sub.getCompanyCode()).orElse(null);
final List<User> managers = userService.getAllManagedUsers(company.getId());
Employee employee = companyService.getEmployeeByCode(company.getId(), sub.getKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public ResponseEntity<List<DayStat>> statistics(
@RequestParam(required=false) String location,
@RequestParam(required=false) Set<String> employeeId,
@RequestParam(required=false, defaultValue = "month") GROUP_BY_TIME timeGroupBy,
@RequestParam(required=false, defaultValue = "total") GROUP_BY_DATA dataGroupBy,
@RequestParam(required=false) GROUP_BY_DATA dataGroupBy,
@RequestParam(required=false, defaultValue = "score") List<STAT_FIELD> fields,
@RequestParam(required=false, defaultValue = "false") boolean all,
@RequestParam(required=false) String from,
Expand Down Expand Up @@ -122,7 +122,7 @@ public void statisticsCSV(
@RequestParam(required=false) String location,
@RequestParam(required=false) Set<String> employeeId,
@RequestParam(required=false, defaultValue = "month") GROUP_BY_TIME timeGroupBy,
@RequestParam(required=false, defaultValue = "total") GROUP_BY_DATA dataGroupBy,
@RequestParam(required=false) GROUP_BY_DATA dataGroupBy,
@RequestParam(required=false, defaultValue = "score") List<STAT_FIELD> fields,
@RequestParam(required=false, defaultValue = "false") boolean all,
@RequestParam(required=false) String from,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package it.smartcommunitylab.pgazienda.domain;

import static org.junit.jupiter.api.Assertions.*;

import it.smartcommunitylab.pgazienda.PGAziendaApp;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Arrays;

@SpringBootTest(classes = PGAziendaApp.class)
public class CircleTest {
private Circle circle;

/**
* Initializes the Circle object with a center at the specified coordinates
* and a radius of 1000 meters. This method is called before each test to
* ensure a fresh instance of Circle is used.
*/
@BeforeEach
public void setup() {
double[] center = {45.4642, 9.1900};
double radius = 1000;
circle = new Circle(center, radius);

circle.setCenter(center);
System.out.println(Arrays.toString(circle.getCenter()));
circle.setRadius(radius);
System.out.println(circle.getRadius());
}

/**
* Verifies that a point is inside the circle.
*
* The test point is located at the coordinates (45.4654, 9.1910).
*
* @see Circle#inside(double, double)
*/
@Test
public void testPointInsideCircle() {
double lat = 45.4654;
double lon = 9.1910;
assertTrue(circle.inside(lat, lon), "The point should be inside the circle");
}

/**
* Verifies that a point is outside the circle.
*
* The test point is located at the coordinates (45.5000, 9.3000).
*
* @see Circle#inside(double, double)
*/
@Test
public void testPointOutsideCircle() {
double lat = 45.5000;
double lon = 9.3000;
assertFalse(circle.inside(lat, lon), "The point should be outside the circle");
}

/**
* Verifies that a point is on the boundary of the circle.
*
* The test point is located at the coordinates (45.4720, 9.1850).
*
* @see Circle#inside(double, double)
*/
@Test
public void testPointOnBoundary() {
double lat = 45.4720;
double lon = 9.1850;
assertTrue(circle.inside(lat, lon), "The point should be on the boundary of the circle");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package it.smartcommunitylab.pgazienda.dto;

import it.smartcommunitylab.pgazienda.PGAziendaApp;
import org.springframework.boot.test.context.SpringBootTest;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;


@SpringBootTest(classes = PGAziendaApp.class)
public class TransportStatDTOTest {

private TransportStatDTO transportStatDTO;

/**
* Creates a new instance of {@link TransportStatDTO} before each test.
*/
@BeforeEach
public void setup() {
transportStatDTO = new TransportStatDTO();
}

/**
* Verifies that the {@link TransportStatDTO#setPeriod(String)} and
* {@link TransportStatDTO#getPeriod()} methods work as expected.
*/
@Test
public void testSetAndGetPeriod() {
String period = "2024-10";
transportStatDTO.setPeriod(period);
assertEquals(period, transportStatDTO.getPeriod(), "The period should be set and retrieved correctly.");
}

/**
* Verifies that the {@link TransportStatDTO#setMean(String)} and
* {@link TransportStatDTO#getMean()} methods work as expected.
*/
@Test
public void testSetAndGetMean() {
String mean = "Bus";
transportStatDTO.setMean(mean);
assertEquals(mean, transportStatDTO.getMean(), "The mean should be set and retrieved correctly.");
}

/**
* Verifies that the {@link TransportStatDTO#setValue(double)} and
* {@link TransportStatDTO#getValue()} methods work as expected.
*/
@Test
public void testSetAndGetValue() {
double value = 123.45;
transportStatDTO.setValue(value);
assertEquals(value, transportStatDTO.getValue(), "The value should be set and retrieved correctly.");
}

/**
* Verifies that the default value of the {@link TransportStatDTO#getValue()}
* method is 0.0.
*/
@Test
public void testDefaultValue() {
assertEquals(0.0, transportStatDTO.getValue(), "The default value should be 0.0.");
}
}
Loading

0 comments on commit 6b8beca

Please sign in to comment.