Skip to content

Commit

Permalink
Fixes for the contest phase attribute on proposal contest phase param…
Browse files Browse the repository at this point in the history
…eters being switched
  • Loading branch information
carlosbpf committed Oct 11, 2019
1 parent c4b65f8 commit a38ea9d
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public ContestPhasePromoteType getContestPhaseAutopromoteEnum() {
public Boolean getProposalVisibility(long proposalId) {
IProposalPhaseClient proposalPhaseClient = StaticProposalContext.getProposalPhaseClient();
IProposalContestPhaseAttribute attr = proposalPhaseClient
.getProposalContestPhaseAttribute(proposalId, this.getId(),
.getProposalContestPhaseAttribute( this.getId(),proposalId,
ProposalContestPhaseAttributeKeys.VISIBLE);
return attr == null || attr.getNumericValue() == 1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private IContestPhaseRibbonType fetchRibbonType(ProposalWrapper proposal) {

IProposalContestPhaseAttribute ribbonAttribute =
StaticProposalContext.getProposalPhaseClient().getProposalContestPhaseAttribute(
proposalId, contestPhase.getId(),
contestPhase.getId(),proposalId,
ProposalContestPhaseAttributeKeys.RIBBON);
if (ribbonAttribute != null) {
long typeId = ribbonAttribute.getNumericValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ public boolean isDeleted() {
long visibleAttributeValue = 1;
if (contestPhase != null) {
IProposalContestPhaseAttribute pcpa = clients.proposalPhase
.getProposalContestPhaseAttribute(this.getId(),
contestPhase.getId(),
.getProposalContestPhaseAttribute(contestPhase.getId(),this.getId(),
ProposalContestPhaseAttributeKeys.VISIBLE);
if (pcpa != null) {
visibleAttributeValue = pcpa.getNumericValue();
Expand Down Expand Up @@ -951,7 +950,7 @@ public ProposalWrapper getBaseProposal() {
long baseProposalContestId = proposalAttributeHelper
.getAttributeValueLong(ProposalAttributeKeys.BASE_PROPOSAL_CONTEST_ID, 0);
if (baseProposalContestId > 0) {
return clients.proposal.getProposal(baseProposalId);
return new ProposalWrapper(clients.proposal.getProposal(baseProposalId));
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ default List<IProposalContestPhaseAttribute> getAllProposalContestPhaseProposalA
default Boolean isProposalContestPhaseAttributeSetAndTrue(Long proposalId, long contestPhaseId,
String name) {
IProposalContestPhaseAttribute proposalAttribute =
getProposalContestPhaseAttribute(proposalId, contestPhaseId, name);
getProposalContestPhaseAttribute(contestPhaseId,proposalId, name);
return proposalAttribute != null && proposalAttribute.getStringValue().equals("true");
}

Expand Down Expand Up @@ -128,15 +128,15 @@ default IProposalContestPhaseAttribute persistProposalContestPhaseAttribute(Long
default boolean hasProposalContestPhaseAttribute(Long proposalId, long contestPhaseId,
String name) {
IProposalContestPhaseAttribute proposalContestPhaseAttribute =
getProposalContestPhaseAttribute(proposalId, contestPhaseId, name);
getProposalContestPhaseAttribute(contestPhaseId,proposalId, name);
return proposalContestPhaseAttribute != null;
}

default IProposalContestPhaseAttribute getOrCreateProposalContestPhaseAttribute(Long proposalId,
Long contestPhaseId, String name, Long aditionalId, Long numericValue,
String stringValue) {
IProposalContestPhaseAttribute proposalContestPhaseAttribute =
getProposalContestPhaseAttribute(proposalId, contestPhaseId, name);
getProposalContestPhaseAttribute( contestPhaseId,proposalId, name);
if (proposalContestPhaseAttribute != null) {
return proposalContestPhaseAttribute;
} else {
Expand All @@ -162,7 +162,7 @@ default IProposalContestPhaseAttribute setProposalContestPhaseAttribute(Long pro
Long contestPhaseId, String name, Long aditionalId, Long numericValue,
String stringValue) {
IProposalContestPhaseAttribute proposalContestPhaseAttribute =
getProposalContestPhaseAttribute(proposalId, contestPhaseId, name);
getProposalContestPhaseAttribute(contestPhaseId,proposalId, name);
if (proposalContestPhaseAttribute != null) {
proposalContestPhaseAttribute.setAdditionalId(aditionalId);
proposalContestPhaseAttribute.setNumericValue(numericValue);
Expand Down Expand Up @@ -193,7 +193,7 @@ IProposalContestPhaseAttribute createProposalContestPhaseAttribute(
default boolean deleteProposalContestPhaseAttribute(Long proposalId, Long contestPhaseId,
String name) {
IProposalContestPhaseAttribute pcpa =
getProposalContestPhaseAttribute(proposalId, contestPhaseId, name);
getProposalContestPhaseAttribute(contestPhaseId,proposalId, name);
return deleteProposalContestPhaseAttribute(pcpa.getId());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public boolean isProposalVisible(ProposalWrapper p) {
}

IProposalContestPhaseAttribute attr = StaticProposalContext.getProposalPhaseClient()
.getProposalContestPhaseAttribute(p.getId(),
phase.getId(), ProposalContestPhaseAttributeKeys.VISIBLE);
.getProposalContestPhaseAttribute(
phase.getId(), p.getId(),ProposalContestPhaseAttributeKeys.VISIBLE);

return attr == null || attr.getNumericValue() != 0;
}

private IProposalContestPhaseAttribute getAttribute(long proposalId, String key) {
return StaticProposalContext.getProposalPhaseClient()
.getProposalContestPhaseAttribute(proposalId, phase.getId(), key);
.getProposalContestPhaseAttribute(phase.getId(),proposalId, key);
}

public boolean isAllProposalsReviewed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ public ProposalJudgingCommentHelper(ProposalWrapper proposal, ContestPhaseWrappe
public String getScreeningComment() {
//get fellow decision
IProposalContestPhaseAttribute fellowActionAttribute = proposalPhaseClient.
getProposalContestPhaseAttribute(proposal.getId(),
getProposalContestPhaseAttribute(
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.FELLOW_ACTION);
FellowAction fellowAction = FellowAction.fromInt(
fellowActionAttribute.getNumericValue().intValue());

if (fellowAction != FellowAction.NO_DECISION &&
fellowAction != FellowAction.PASS_TO_JUDGES) {
String fellowRejectionText = proposalPhaseClient.
getProposalContestPhaseAttribute(proposal.getId(),
getProposalContestPhaseAttribute(
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.FELLOW_ACTION_COMMENT)
.getStringValue();

Expand All @@ -68,7 +70,7 @@ public String getSubject(){
}
public void setScreeningComment(String comment) {
IProposalContestPhaseAttribute fellowActionAttribute = proposalPhaseClient.
getProposalContestPhaseAttribute(proposal.getId(), contestPhase.getId(), ProposalContestPhaseAttributeKeys.FELLOW_ACTION);
getProposalContestPhaseAttribute(contestPhase.getId(), proposal.getId(), ProposalContestPhaseAttributeKeys.FELLOW_ACTION);
FellowAction fellowAction = FellowAction.fromInt(fellowActionAttribute.getNumericValue().intValue());

//save comment if the action is "incomplete" or "off-topic"
Expand All @@ -80,16 +82,16 @@ public void setScreeningComment(String comment) {

public String getAdvancingComment() {
IProposalContestPhaseAttribute advanceDecisionAttribute = proposalPhaseClient.
getProposalContestPhaseAttribute(proposal.getId(), contestPhase.getId(),
getProposalContestPhaseAttribute(contestPhase.getId(),proposal.getId(),
ProposalContestPhaseAttributeKeys.JUDGE_DECISION);

if (advanceDecisionAttribute != null) {
AdvanceDecision advanceDecision = AdvanceDecision.fromInt(
advanceDecisionAttribute.getNumericValue().intValue());

if (advanceDecision != AdvanceDecision.NO_DECISION) {
return proposalPhaseClient.getProposalContestPhaseAttribute(proposal.getId(),
contestPhase.getId(), ProposalContestPhaseAttributeKeys.PROPOSAL_REVIEW)
return proposalPhaseClient.getProposalContestPhaseAttribute(
contestPhase.getId(), proposal.getId(), ProposalContestPhaseAttributeKeys.PROPOSAL_REVIEW)
.getStringValue();
}
}
Expand Down Expand Up @@ -119,8 +121,9 @@ public String getPromotionComment(boolean isWrapWithTemplate) {
//get fellow decision

IProposalContestPhaseAttribute fellowActionAttribute = proposalPhaseClient
.getProposalContestPhaseAttribute(proposal.getId(),
.getProposalContestPhaseAttribute(
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.FELLOW_ACTION);
FellowAction fellowAction = fellowActionAttribute != null
? FellowAction
Expand All @@ -131,15 +134,17 @@ public String getPromotionComment(boolean isWrapWithTemplate) {
if (fellowAction == FellowAction.PASS_TO_JUDGES) {
final IProposalContestPhaseAttribute reviewTextAttribute =
proposalPhaseClient.
getProposalContestPhaseAttribute(proposal.getId(),
getProposalContestPhaseAttribute(
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.PROPOSAL_REVIEW);
String reviewText = reviewTextAttribute != null
? reviewTextAttribute.getStringValue() : "";

IProposalContestPhaseAttribute advanceDecisionAttribute = proposalPhaseClient
.getProposalContestPhaseAttribute(proposal.getId(),
.getProposalContestPhaseAttribute(
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.JUDGE_DECISION);
AdvanceDecision advanceDecision =
advanceDecisionAttribute != null
Expand Down Expand Up @@ -170,8 +175,8 @@ public String getPromotionComment(boolean isWrapWithTemplate) {
} else if (fellowAction != FellowAction.NO_DECISION) {
final IProposalContestPhaseAttribute fellowReviewTextAttribute =
proposalPhaseClient.getProposalContestPhaseAttribute(
proposal.getId(),
contestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.FELLOW_ACTION_COMMENT
);
String fellowReviewText = fellowReviewTextAttribute != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,9 @@ private String moveProposals(ProposalContext proposalContext, List<ProposalWrapp
//first, see if a ribbon already exists

IProposalContestPhaseAttribute attribute = proposalPhaseClient
.getProposalContestPhaseAttribute(proposal.getId(),
.getProposalContestPhaseAttribute(
moveToContestPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.RIBBON);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private String getProposalJudgeReviewCsv(ContestWrapper contest, ContestPhaseWra
for (ProposalWrapper proposal : stillActiveProposals) {
IProposalContestPhaseAttribute fellowActionAttribute =
StaticProposalContext.getProposalPhaseClient()
.getProposalContestPhaseAttribute(proposal.getId(), judgingPhase.getId(),
.getProposalContestPhaseAttribute(judgingPhase.getId(),proposal.getId(),
ProposalContestPhaseAttributeKeys.FELLOW_ACTION);

if (fellowActionAttribute != null) {
Expand Down Expand Up @@ -190,8 +190,9 @@ private List<UserWrapper> getProposalReviewingJudges(ProposalWrapper proposal, C

if (judgingPhase.getFellowScreeningActive()) {
final IProposalContestPhaseAttribute selectedJudgesAttribute = proposalPhaseClient
.getProposalContestPhaseAttribute(proposal.getId(),
.getProposalContestPhaseAttribute(
judgingPhase.getId(),
proposal.getId(),
ProposalContestPhaseAttributeKeys.SELECTED_JUDGES);
if (selectedJudgesAttribute == null) {
throw new IllegalStateException("Fellow screening active,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private Boolean wasProposalPromotedInContestPhase(ProposalContext proposalContex
proposalContext.getClients().getProposalPhaseClient();
IProposalContestPhaseAttribute judgingDecisionAttr =
proposalPhaseClient.getProposalContestPhaseAttribute(
proposal.getId(), contestPhase.getId(),
contestPhase.getId(),proposal.getId(),
ProposalContestPhaseAttributeKeys.JUDGE_DECISION);
if (judgingDecisionAttr != null) {
Long judgingDecision = judgingDecisionAttr.getNumericValue();
Expand Down

0 comments on commit a38ea9d

Please sign in to comment.