Skip to content

Commit

Permalink
Merge pull request #29 from Best-offer-finder/not-starting-timer-if-n…
Browse files Browse the repository at this point in the history
…o-filter

Do not load scheme if no filter is set
  • Loading branch information
Rivixer authored Jun 22, 2024
2 parents 17b11dc + 21ffac0 commit d4246e2
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

Expand All @@ -47,7 +46,7 @@
public class SchemeService {

public static final String TIMER_NAME = "OtomotoTimer";
private static final String EMPTY_JSON_OBJECT = "{}";
private static final String EMPTY_FILTERS_JSON_OBJECT = "{\"variables\":{\"filters\":[]}}";
private static final Logger LOGGER = LoggerFactory.getLogger(SchemeService.class);
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final int PAGE_SIZE = 32;
Expand Down Expand Up @@ -174,12 +173,14 @@ public void checkNewOffersCount(List<SchemeDto> schemeDtoList) {
* <p>
* Loop is finished when there are no more new cars
* (objects from API are repeating with objects inside database)
* <p>
* If no filter is set, then the scheme is being ignored.
*
* @param scheme currently processed scheme
* @param query final GraphQL indicating String query
*/
public void loadDataForSingleScheme(Scheme scheme, String query, boolean oneTime) {
if (scheme.getData().equals(EMPTY_JSON_OBJECT))
if (scheme.getData().equals(EMPTY_FILTERS_JSON_OBJECT))
return;

OtomotoDto otomotoDto;
Expand Down

0 comments on commit d4246e2

Please sign in to comment.