mirror of
https://github.com/Sheldan/Sissi.git
synced 2026-01-01 07:27:29 +00:00
[SIS-xxx] slight adaptions for new donation structure
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -50,6 +51,11 @@ public class DebraDonationStatusController {
|
|||||||
|
|
||||||
return CampaignInfo
|
return CampaignInfo
|
||||||
.builder()
|
.builder()
|
||||||
|
.donationCount(donationResponse.getDonationCount())
|
||||||
|
.collected(donationResponse.getCurrentDonationAmount())
|
||||||
|
.target(donationResponse.getDonationAmountGoal())
|
||||||
|
.percent(donationResponse.getCurrentDonationAmount().divide(donationResponse.getDonationAmountGoal(), RoundingMode.CEILING))
|
||||||
|
.currency("€")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,13 @@ import lombok.Builder;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.BigInteger;
|
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
@Getter
|
@Getter
|
||||||
public class CampaignInfo {
|
public class CampaignInfo {
|
||||||
private BigInteger donationCount;
|
private Integer donationCount;
|
||||||
private BigDecimal collected;
|
private BigDecimal collected;
|
||||||
private BigDecimal target;
|
private BigDecimal target;
|
||||||
private String currency;
|
private String currency;
|
||||||
private String slug;
|
|
||||||
private String displayName;
|
|
||||||
private BigDecimal collectedNet;
|
|
||||||
private BigDecimal percent;
|
private BigDecimal percent;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ def rendering_donation_image(donation_stats, parameters):
|
|||||||
height = parameters.font_size
|
height = parameters.font_size
|
||||||
it = 0
|
it = 0
|
||||||
for donation in donations_to_draw:
|
for donation in donations_to_draw:
|
||||||
name = donation['firstName'] if not donation['anonymous'] else 'anonym'
|
name = donation['name'] if not donation['anonymous'] and 'name' in donation else 'anonym'
|
||||||
d1.text((0, height * it), f"{donation['donationAmount']}€ von {name}", fill=parameters.color, font=font)
|
d1.text((0, height * it), f"{donation['donationAmount']}€ von {name}", fill=parameters.color, font=font)
|
||||||
it += 1
|
it += 1
|
||||||
return flask_utils.serve_pil_image(img)
|
return flask_utils.serve_pil_image(img)
|
||||||
|
|||||||
Reference in New Issue
Block a user