Skip to content

Instantly share code, notes, and snippets.

App.competition = App.cable.subscriptions.create "CompetitionChannel",
connected: ->
# Called when the subscription is ready for use on the server
disconnected: ->
# Called when the subscription has been terminated by the server
received: (data) ->
# Decision that the message that comes is a message that is sent during the competition
if data["type"] == "roast"
import React from 'react';
import {
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
AsyncStorage,
} from 'react-native';
import React from 'react';
import {
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
AsyncStorage,
AppRegistry,
import React from 'react';
import { AppRegistry, StyleSheet, Text, View, AsyncStorage } from 'react-native';
import { StackNavigator } from 'react-navigation';
import HomeScreen from './screens/HomeScreen';
import UserScreen from './screens/users/UserScreen';
export default class App extends React.Component {
async getId()
{
import React from 'react';
import {
Image,
Platform,
ScrollView,
StyleSheet,
Text,
TouchableOpacity,
View,
TextInput,
Competition.joins("LEFT JOIN keywords_and_users ON keywords_and_users.user_id = #{session[:user_id]}").where(id: CompetitionsAndKeyword.where(keyword_id: KeywordsAndUser.where(user_id: session[:user_id]).pluck(:keyword_id)).pluck(:competition_id)).order("(interested / views) * keywords_and_users.score DESC")
Marketer.find(Marketer.joins("LEFT JOIN users ON users.id = #{session[:user_id].to_s}", "LEFT JOIN keywords_and_users ON keywords_and_users.user_id = users.id", "LEFT JOIN matchings ON matchings.user_id = users.id AND matchings.marketer_id = marketers.id", "LEFT JOIN marketers_and_keywords ON marketers_and_keywords.marketer_id = marketers.id").where(display: [2, 3], id: MarketersAndKeyword.where(keyword_id: Keyword.find(KeywordsAndUser.where(user_id: session[:user_id]).pluck(:keyword_id))).pluck(:marketer_id)).order("CASE WHEN matchings.id is null THEN marketers.cpm * keywords_and_users.score ELSE marketers.cpm * (keywords_and_users.score / 4) END DESC").pluck(:id).uniq).first