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.RestController;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@@ -50,6 +51,11 @@ public class DebraDonationStatusController {
|
||||
|
||||
return CampaignInfo
|
||||
.builder()
|
||||
.donationCount(donationResponse.getDonationCount())
|
||||
.collected(donationResponse.getCurrentDonationAmount())
|
||||
.target(donationResponse.getDonationAmountGoal())
|
||||
.percent(donationResponse.getCurrentDonationAmount().divide(donationResponse.getDonationAmountGoal(), RoundingMode.CEILING))
|
||||
.currency("€")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,17 +4,13 @@ import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
public class CampaignInfo {
|
||||
private BigInteger donationCount;
|
||||
private Integer donationCount;
|
||||
private BigDecimal collected;
|
||||
private BigDecimal target;
|
||||
private String currency;
|
||||
private String slug;
|
||||
private String displayName;
|
||||
private BigDecimal collectedNet;
|
||||
private BigDecimal percent;
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ def rendering_donation_image(donation_stats, parameters):
|
||||
height = parameters.font_size
|
||||
it = 0
|
||||
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)
|
||||
it += 1
|
||||
return flask_utils.serve_pil_image(img)
|
||||
|
||||
Reference in New Issue
Block a user