This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
salesforceUpdateCompany( | |
input: { | |
salesforceUserId: "USER_TEST_ID_1" # Salesforce user's id who currently accessing the edit page | |
clientId: "Put here the client ID that I given to you" | |
secretKey: "Put here the secretKey that I given to you" | |
salesforceCompanyId: "COMPANY_TEST_ID" # Salesforce organization's id (same value from onboarding) | |
companyName: "Verizon" | |
description: "Description if there's a content" | |
website: "verizon.test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_score | |
questions = self.exam.questions.published | |
user_answers = self.answers | |
answered_questions_ids = user_answers.pluck(:exam_question_id) | |
# Counting the right answer to get the percentage | |
if exam.small_bite? | |
total_correct = 0 | |
total_score = questions.not_essays.count | |
questions.each do |question| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- # SmallBite - Checks | |
- # SmallBiteSetContent - Surveys | |
- exam_questions = @object.exam_questions.published.sort_by_position | |
.row-fluid | |
.col-sm-12 | |
.heading-block{class: "#{'clean-header' if clean_layout?}"} | |
.link-menu{class: "#{'clearfix' if clean_layout?}"} | |
.button-set{style: ("display: none;" if params[:q].present?)} | |
- if @object.is_a?(SmallBite) | |
- if admin? || (@object.group.present? && can_manage?(object: @object.group) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Using aws-sdk and aws-sdk-s3 v1. | |
# Allows to move a folder and files inside of it to other directory | |
# Allows to rename a file or folder. | |
# Thanks to: https://gist.github.com/peterwake/49a829d2062ad3c5962435341692a680 | |
# Usage: | |
# s3 = Aws::S3::Resource.new(credentials) | |
# s3_move = S3::Move.new(s3, ENV['S3_BUCKET_NAME']) | |
# s3_move.move_folder(old_key: object_path, new_key: new_object_path, mode: "rename") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Controller Action | |
def custom_download | |
id = params[:id] | |
# model variable should have value like: Slide, DriveDocument, User, etc. | |
model = params[:model] | |
# file variable: should have paperclip object name like: attachment, image, etc. | |
file = params[:file] | |
if model.present? && id.present? && file.present? |