Skip to content

Instantly share code, notes, and snippets.

View anjanaraveendra's full-sized avatar

Anjana anjanaraveendra

View GitHub Profile
#SurveyController Class
class Api::V1::SurveysController < Api::V1::BaseController
before_action :set_survey, only: [:show, :questions]
def index
# Api to get all current user schedules for the current time
@schedules = @account.schedules.includes(:survey, survey_version: :departments).joins(:survey)
.where(surveys: { status: 1 }, completed_at: nil).where(ignore: false)
.where('schedules.start_time <= :time AND schedules.buffer_time >= :time', time: Time.current)
.order('schedules.start_time asc')
<!DOCTYPE html>
<html>
<head>
<style>
#box {
width: 100px;
height: 100px;
border: 10px solid green;
padding: 25px;
margin: 25px;