Skip to content

Commit

Permalink
#958: use quarter utils in test mode only
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzi-cato committed Aug 14, 2024
1 parent 06c9fd4 commit 58a95b4
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package ch.puzzle.okr.util.quarter.generate;

import org.springframework.context.annotation.Profile;

import java.time.LocalDate;

/**
* Quarter data for H2 database.</br>
* </br>
* This class is used for testing purposes only. Do NOT use this class in production mode.
*/
@Profile("integration-test")
public record QuarterData(String label, LocalDate startDate, LocalDate endDate) {

public String startDateAsIsoString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package ch.puzzle.okr.util.quarter.generate;

import org.springframework.context.annotation.Profile;

import java.time.LocalDate;

/**
* Quarter label for H2 database.</br>
* </br>
* This class is used for testing purposes only. Do NOT use this class in production mode.
*/
@Profile("integration-test")
public class QuarterLabel {
private final LocalDate date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
package ch.puzzle.okr.util.quarter.generate;

import org.springframework.context.annotation.Profile;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

/**
* Static initialize quarters for H2 database.</br>
* </br>
* This class is used for testing purposes only. Do NOT use this class in production mode.
*/
@Profile("integration-test")
public class Quarters {
private record QuarterDateRange(LocalDate startDate, LocalDate endDate) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

import ch.puzzle.okr.util.quarter.generate.QuarterData;
import ch.puzzle.okr.util.quarter.generate.Quarters;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;

/**
* Quarter functions for H2 database.</br>
* </br>
* This class is used for testing purposes only. Do NOT use this class in production mode.
*/
@Component
@Profile("integration-test")
public class QuarterFunction {
public static final int CURRENT_QUARTER_DB_ID = 2;
public static final int NEXT_QUARTER_DB_ID = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ values (2, CURRENT_QUARTER_LABEL(), CURRENT_QUARTER_START_DATE(), CURRENT_QUARTE
(99, 'GJ ForTests', '2000-07-01', '2000-09-30'),
(999, 'Backlog', null, null);

select * from quarter;

insert into team (id, version, name)
values (4, 1, '/BBT'),
(8, 1, 'we are cube.³'),
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ yarn-error.log
/libpeerconnection.log
testem.log
/typings
/src/app/version.ts

# System files
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = 'v';
export const version = 'v2.0.133';

0 comments on commit 58a95b4

Please sign in to comment.