I have a Customer model that has the following data:
private Long int;
@OneToMany(mappedBy = "client", cascade = CascadeType.ALL)
private List<Results> results;
and Model results have the following information:
@ManyToOne
@JoinColumn(name='client_id')
private Client client;
@OneToOne
private Scores score;
private Date submittedDate;
I am trying to achieve this:
For each user to receive an assessment of their first result and an assessment of their last result, find the difference. And then average all the differences. How to write this function that calculates it?
The client returns a list of all the results, and then for the difference: results [last] - results [0] and then the cycle:
for (int i=0; i <= client.count(); i++)
difference = results[last] - results[0];
sum += difference;
average = sum/client.count();`
It's just hard for me to turn this into code that works in Spring. Am I writing this in ClientServiceImplementation and then getting requests in ClientRepository? Any help is appreciated.
assessment class has:
private Long id;
private Double score;
source
share