Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Re-add bars for professor-side poll results] #356

Merged
merged 9 commits into from
Mar 4, 2020
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 25 additions & 29 deletions Pollo/Views/Cards/MCResultCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,48 +169,44 @@ class MCResultCell: UICollectionViewCell {
let answer = intToMCOption(resultModel.choiceIndex)
switch userRole {
case .admin:
containerView.backgroundColor = correctAnswer == answer ? .lightGreen : .lightGrey
containerView.layer.borderWidth = containerViewBorderWidth
containerView.layer.cornerRadius = containerViewCornerRadius
highlightView.isHidden = true
numSelectedLabel.isHidden = false
dotView.isHidden = true
optionLabel.textColor = .black
case .member:
containerView.backgroundColor = .clear
containerView.layer.borderWidth = highlightViewBorderWidth
containerView.layer.cornerRadius = highlightViewCornerRadius
optionLabel.textColor = .mediumGrey
numSelectedLabel.isHidden = true
dotView.isHidden = false
let isSelected = resultModel.isSelected
selectedDotView.isHidden = !isSelected
selectedImageView.isHidden = selectedDotView.isHidden
if let correctAnswer = correctAnswer, !correctAnswer.isEmpty {
if answer == correctAnswer {
if isSelected {
selectedDotView.backgroundColor = .clear
selectedImageView.image = UIImage(named: correctImageName)
}
showCorrectAnswer = true
highlightView.backgroundColor = .lightGreen
highlightView.layer.borderColor = UIColor.polloGreen.cgColor
} else {
if isSelected {
selectedDotView.backgroundColor = .clear
selectedImageView.image = UIImage(named: incorrectImageName)
}
highlightView.backgroundColor = .lightGrey
highlightView.layer.borderColor = UIColor.coolGrey.cgColor
optionLabel.textColor = .mediumGrey
}
containerView.backgroundColor = .clear
containerView.layer.borderWidth = highlightViewBorderWidth
containerView.layer.cornerRadius = highlightViewCornerRadius
let isSelected = resultModel.isSelected
selectedDotView.isHidden = !isSelected
selectedImageView.isHidden = selectedDotView.isHidden
if let correctAnswer = correctAnswer, !correctAnswer.isEmpty {
if answer == correctAnswer {
if isSelected {
selectedDotView.backgroundColor = .clear
selectedImageView.image = UIImage(named: correctImageName)
}
showCorrectAnswer = true
highlightView.backgroundColor = .lightGreen
highlightView.layer.borderColor = UIColor.polloGreen.cgColor
} else {
if isSelected {
selectedDotView.backgroundColor = .coolGrey
selectedImageView.image = nil
selectedDotView.backgroundColor = .clear
selectedImageView.image = UIImage(named: incorrectImageName)
}
highlightView.backgroundColor = .lightGrey
highlightView.layer.borderColor = UIColor.coolGrey.cgColor
}
} else {
if isSelected {
selectedDotView.backgroundColor = .coolGrey
selectedImageView.image = nil
}
highlightView.backgroundColor = .lightGrey
highlightView.layer.borderColor = UIColor.coolGrey.cgColor
chalo2000 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down