Skip to content

Commit

Permalink
Display user newsfeed (#74)
Browse files Browse the repository at this point in the history
* Vivian branch seminar (#49)

* Parses input for create event page

* Create event will add to the datebase

* not broken

* Transfer div kind of works

* transfer model should add organizers to db

* fixes for transfer model

* create page event works

* create seminar page can pull event names from database

* trying fetch stuff

* please take the fetch attempt things

* calendar changes that apparently did not get pushed

* create seminar page displays events and it is selectable

* create seminar page connects to the database

* fixes for createSeminar dropdown for events reflect selection and seminar created succesfully

* transfer data div is fixed now it displays last name and it does not display yourself as a selectable user

* create event fixed, pushes two of the current user before

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Create event page now works like the seminar page with the date picker, time picker and transfer component fixed.

* Vivian branch (#71)

* Parses input for create event page

* Create event will add to the datebase

* not broken

* Transfer div kind of works

* transfer model should add organizers to db

* fixes for transfer model

* create page event works

* create seminar page can pull event names from database

* trying fetch stuff

* please take the fetch attempt things

* calendar changes that apparently did not get pushed

* create seminar page displays events and it is selectable

* create seminar page connects to the database

* fixes for createSeminar dropdown for events reflect selection and seminar created succesfully

* transfer data div is fixed now it displays last name and it does not display yourself as a selectable user

* create event fixed, pushes two of the current user before

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Create event page now works like the seminar page with the date picker, time picker and transfer component fixed.

* Vivian branch seminar (#49) (#60)

* Parses input for create event page

* Create event will add to the datebase

* not broken

* Transfer div kind of works

* transfer model should add organizers to db

* fixes for transfer model

* create page event works

* create seminar page can pull event names from database

* trying fetch stuff

* please take the fetch attempt things

* calendar changes that apparently did not get pushed

* create seminar page displays events and it is selectable

* create seminar page connects to the database

* fixes for createSeminar dropdown for events reflect selection and seminar created succesfully

* transfer data div is fixed now it displays last name and it does not display yourself as a selectable user

* create event fixed, pushes two of the current user before

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Transfer data component is fixed, you as the user won't appear on the available organizer list. Event duration is ordered in terms of start date and time then end date and time.

* Create event page now works like the seminar page with the date picker, time picker and transfer component fixed.

* News are no longer all the same date. Newsfeed completed. Create event and seminar has default of FFA if nothing is chosen and decimals are rounded to whole numbers.

* merge fixes 2

* Changes to make newsfeed work that were deleted in last commit of VivianBranch
  • Loading branch information
Tamara Charchoghlyan authored Nov 9, 2018
1 parent e055c53 commit f41c6a6
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 43 deletions.
8 changes: 4 additions & 4 deletions api/src/migrations/002_create_sample_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ insert into Seminar_Wait_list (user_id, seminar_id,date_added) values (3,2, TIME


-- 2 Annoucements
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'The end is nigh, remember your wallet',TIMESTAMP '2010-10-31 8:30:00', TIMESTAMP '2010-10-31 8:30:00');
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'Remember your doom',TIMESTAMP '2010-10-31 8:30:00', TIMESTAMP '2010-10-31 8:30:00');
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (4,'Bug Fixing Party',TIMESTAMP '2010-10-31 8:30:00', TIMESTAMP '2010-10-31 8:30:00');
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (3,'Reminder to participants to bring laptops',TIMESTAMP '2019-10-23 8:30:00+02', TIMESTAMP '2019-10-23 8:30:00+02');
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'The end is nigh, remember your wallet',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-31 19:00:00');
insert into Event_Announcement (event_id, message, date_created, date_modified) values (3,'Remember your doom',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-11-01 8:45:00');
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (4,'Bug Fixing Party',TIMESTAMP '2018-10-31 8:30:00', TIMESTAMP '2018-10-13 8:30:00');
insert into Seminar_Announcement (seminar_id, message, date_created, date_modified) values (3,'Reminder to participants to bring laptops',TIMESTAMP '2018-10-23 8:30:00+02', TIMESTAMP '2018-10-23 8:30:00+02');


-- One user following
Expand Down
98 changes: 63 additions & 35 deletions frontend/src/views/apps/Timeline.vue
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
<template>
<div class="page-timeline scrollable only-y">
<div class="page-header">
<h1>Newsfeed</h1>
<div class="page-header" style="margin-bottom:20px">
<h1>{{user.first_name}}'s Newsfeed</h1>
</div>

<div class="timeline-box card-base card-shadow--medium">


<div v-if="news.length!==0">
<timeline timeline-theme="lightblue">
<timeline-title>May 25, 2018</timeline-title>
<timeline-item color="#9dd8e0">
Anime North<br>
<small> Anime North passes will be available for pickup from 4:30pm to 7:30pm. </small>
</timeline-item>
<timeline-item>
<img src="@/assets/images/twitchicon.png" class="icon-time" slot="others" alt="Twitch">
Twitch Con<br>
<small> The streamer room has been moved to hall C. Sorry for the inconvenience. </small>
</timeline-item>
<timeline-title color="pink">May 14, 2018</timeline-title>
<timeline-item>
<img src="@/assets/images/twitchicon.png" class="icon-time" slot="others" alt="Twitch">
<p>Twitch Con: Streamer Box</p>
<small> Make sure to check our twitter: @TwitchBox to catch your favourite streamer. </small>
</timeline-item>
<timeline-item>
<img src="@/assets/images/youtubeicon.png" class="icon-time" slot="others" alt="Twitch">
<p>Meet and greet with LilyPichu</p>
<small> Hope to see you guys there! </small>
</timeline-item>
<timeline-item line-color="#a6ade4">
<p>CUSEC</p>
<small> Purchase your tickets early for a discount! </small>
</timeline-item>

<div v-for=" (i,key) in news" :key='key' >
<timeline-item color="#0091e0" v-if="i.type==='event_type'">
{{i.name}} <br>
<small> "{{ i.message }}" </small>
<p style="color:grey;font-size:50%;"> {{i.timestamp}} </p>
</timeline-item>

<timeline-item color="#ff9484" v-else-if="i.type==='seminar_type'">
{{i.name}} <br>
<small> "{{ i.message }}" </small>
<p style="color:grey;font-size:50%;"> {{i.timestamp}} </p>
</timeline-item>
</div>

</timeline>
</div>

<div v-if="news.length===0">
<p style="color:grey;font-size:200%;text-align:center"> You are not following anything :( </p>
</div>

</div>
</div>
</template>

<script>
import { Timeline, TimelineItem, TimelineTitle } from 'vue-cute-timeline'
import * as moment from 'moment'
import { createApolloFetch } from "apollo-fetch"
const fetch = createApolloFetch({ uri: "http://localhost:4000/graphql" });
console.clear()
export default {
name: 'TimelinePage',
Expand All @@ -48,37 +49,64 @@ export default {
TimelineItem,
TimelineTitle
}
,
,
data() {
return {
user: this.$store.state.user
user: this.$store.state.user,
news: []
}
},
mounted() {
console.clear()
fetch({
query: `query getMyAnnoucements($ID: Int!){
getMyAnnoucements(userID: $ID) {
query: `query getMyAnnouncements($ID: Int!){
getMyAnnouncements(userID: $ID) {
type_name
message
date_modified
type
}
}`
,
variables: {ID: this.user.id}
}).then(res => {
for (var i = 0; i < res.data.getMyAnnouncements.length; i++) {
res.data.getMyAnnouncements[i].date_modified = moment(parseInt(res.data.getMyAnnouncements[i].date_modified,10)).format("MMMM Do YYYY, h:mm a")
this.news.push({
name: res.data.getMyAnnouncements[i].type_name,
message: res.data.getMyAnnouncements[i].message,
timestamp: res.data.getMyAnnouncements[i].date_modified,
type: res.data.getMyAnnouncements[i].type
});
console.log("news[" + i + "]: \n");
console.log(" " + this.news[i].name);
console.log(" " + this.news[i].message);
console.log(" " + this.news[i].timestamp);
console.log(" " + this.news[i].type);
}
if (res.data) {
this.managingEvents = res.data.getMyManagingEventsAndSeminars
} else {
console.log(res.errors)
}
}
}).catch(err => {
console.log(err);
});
}
// ,
// methods: {
// }
}
</script>

Expand Down
9 changes: 6 additions & 3 deletions frontend/src/views/pages/CreateEvent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,18 @@
<el-radio v-model="capacityType" label="FCFS_E">First come first serve (electronically)</el-radio>

<el-input-number
v-if="capacityType==1"
v-if="capacityType=='FFA'"
disabled
v-model="capacityNum"
:precision="0"
:min="1"
:max="9999">
</el-input-number>

<el-input-number
v-if="capacityType!=1"
v-if="capacityType!='FFA'"
v-model="capacityNum"
:precision="0"
:min="1"
:max="9999">
</el-input-number>
Expand Down Expand Up @@ -123,7 +125,8 @@ export default {
endDate: '',
startTime: '',
endTime: '',
capacityType: '',
capacityType: 'FFA',
capacityNum: 1,
countryInput: '',
cityInput: '',
Expand Down
6 changes: 5 additions & 1 deletion frontend/src/views/pages/CreateSeminar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,16 @@
v-if="capacityType=='FFA'"
disabled
v-model="capacityNum"
:precision="0"

:min="1"
:max="9999">
</el-input-number>

<el-input-number
v-if="capacityType!='FFA'"
v-model="capacityNum"
:precision="0"
:min="1"
:max="9999">
</el-input-number>
Expand Down Expand Up @@ -130,7 +133,8 @@ export default {
endDate: '',
startTime: '',
endTime: '',
capacityType: '',
capacityType: 'FFA',
capacityNum: 1,
countryInput: '',
cityInput: '',
Expand Down

0 comments on commit f41c6a6

Please sign in to comment.