Skip to content
This repository has been archived by the owner on Nov 2, 2019. It is now read-only.

Converting Date/Time to EST #200

Merged
merged 38 commits into from
Apr 2, 2018
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1466552
Fixed spacing for prettyifyDate
ashley Mar 28, 2018
d9a7d09
Import moment
ashley Mar 28, 2018
730a795
Made helper preProcess for date conversion
ashley Mar 28, 2018
0790ebc
Convert Event dates to EST
ashley Mar 28, 2018
085df12
Fixed organization time
ashley Mar 28, 2018
b0e1c2d
Revert organization date conversion for refactoring
ashley Mar 28, 2018
5ff8e15
Made default created and modifed times EST
ashley Mar 28, 2018
192fcac
Fixed typo
ashley Mar 28, 2018
1b158e5
Test case when time is null
ashley Mar 28, 2018
0339983
Deleted console
ashley Mar 28, 2018
0710d90
made changeDate function in PreProcess
ashley Mar 28, 2018
4660dd7
Converted dates in expenses
ashley Mar 28, 2018
f4bb822
Converted time to EST in Incomes
ashley Mar 28, 2018
5481279
Converted time to EST in Jobs
ashley Mar 28, 2018
61f0fc2
Convert time to EST in membership
ashley Mar 28, 2018
f98dacf
Converted time to EST in organizations
ashley Mar 28, 2018
a9a3bb3
Converted time to EST in Person
ashley Mar 28, 2018
0b218c0
Converted time to EST in Position
ashley Mar 28, 2018
629cb6c
Converted time to EST in Reinbursement
ashley Mar 28, 2018
226ef50
Converted time to EST in Venues
ashley Mar 28, 2018
5b9e6ff
Fixed extra comment
ashley Mar 28, 2018
35ede41
Refactor Events time code
ashley Mar 28, 2018
eb51fcc
Fixed moment version bug
ashley Mar 29, 2018
fe90fa0
Revert "Converted time to EST in Venues"
ashley Mar 29, 2018
67ffeb7
Merge branch 'develop' into ashleychen.dev.time
ashleytqy Mar 29, 2018
630cf83
Remove preProcess comment
ashley Mar 29, 2018
47574ab
Fixed formatting of converted dates
ashley Mar 29, 2018
abc9abc
Merging
ashley Mar 29, 2018
cce7719
Remove preProcess commented code
ashley Mar 29, 2018
e94cde7
Included optional Array of attributes to convert Time in preProcess
ashley Mar 29, 2018
a3dca58
Refactored incomes list controller
ashley Mar 30, 2018
0e23792
Rename changeDate() function to convertTimeAtrtributes()
ashley Mar 30, 2018
42fe41f
Extra semicolon
ashley Mar 30, 2018
9f8c58e
Replace prettifyDate() with moment implementation
ashley Mar 30, 2018
46c49a1
Duplicate job expiration date
ashley Mar 30, 2018
fd8ea9b
Bad spelling
ashley Mar 30, 2018
f98ba66
Change paramenter from array to rest
ashley Apr 2, 2018
936d6b6
Reverting code change for preprocessing
ashley Apr 2, 2018
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
7 changes: 5 additions & 2 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
<script src="/js/lib/chosen-angular.js"></script>
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
<script src="/js/lib/angular-ui-tinymce.js"></script>

<!-- User Defined Libraries -->
<script src="/js/lib/extensions.js"></script>
<script src="/js/lib/extensions.js"></script>
<script src="/js/lib/moment.js"></script>
<script src="/js/lib/moment.min.js"></script>
<script src="/js/lib/moment-timezone-with-data-2012-2022.min.js"></script>

<!--User Defined JavaScript-->
<script src="/js/app.js"></script>
Expand Down
7 changes: 5 additions & 2 deletions app/js/controllers/actions/default/default-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular
.module('app.controllers')
.controller('DefaultListCtrl', function($scope, $rootScope, $stateParams, $state, Restangular, apiDescriptor, dataTransformer) {
.controller('DefaultListCtrl', function($scope, $rootScope, $stateParams, $state, Restangular, apiDescriptor, dataTransformer, preProcess) {
var resourceName = $stateParams.resourceName;
var resourceId = $stateParams.id;
$scope.resourceName = resourceName;
Expand All @@ -21,10 +21,13 @@ angular
if (resourceId) {
$scope.model = _.find($scope.data, {id: resourceId});
}
_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spelling -> Attributes

});
});

$scope.updateSelection = function(newModelId) {
// $state.go("list", {id: newModelId});
//$state.go("list", {id: newModelId});
$state.transitionTo('list',
{id: newModelId},
{notify: false}
Expand Down
7 changes: 6 additions & 1 deletion app/js/controllers/actions/event/event-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ angular
rsvpCount: {},
altRsvps: {},
aims: {},
categories: {}
categories: {},
time : {}
};

//mapping personID to personName
Expand All @@ -57,6 +58,10 @@ angular
}

_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
$scope.eventDetails.time[element.id] = {};
$scope.eventDetails.time[element.id].start = preProcess.convertTimeToEST(element.attributes.startDateTime);
$scope.eventDetails.time[element.id].end = preProcess.convertTimeToEST(element.attributes.endDateTime);
//mapping eventID to venue names with links
if (element.relationships.venue.data !== null) {
var venueURL = "/#/r/venues/list/" + element.relationships.venue.data.id;
Expand Down
1 change: 1 addition & 0 deletions app/js/controllers/actions/expenses/expenses-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ angular
}

_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
//mapping expenseID to reimbursementID
if (element.relationships.reimbursementFor.data !== null) {
const url = "https://api.tnyu.org/v3/reimbursement-requests/" + element.relationships.reimbursementFor.data.id;
Expand Down
1 change: 1 addition & 0 deletions app/js/controllers/actions/incomes/incomes-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ angular
}

_.each($scope.data, element => {
element = preProcess.convertTimeAtrtributes(element, Array("recievedOn"));
Copy link
Contributor

@ashleytqy ashleytqy Mar 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you are using ...attributeArray, "recievedOn" doesn't need to be in an array. u could do element = preProcess.convertTimeAttributes(element, "recievedOn"), unless you want to change the signature of the function

Restangular.one("people/" + element.relationships.authorizer.data.id)
.get()
.then(data => {
Expand Down
2 changes: 1 addition & 1 deletion app/js/controllers/actions/jobs/jobs-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ angular
var index = _.findIndex($scope.data, {id: resourceId});
$scope.model = $scope.data[index];
}

_.each($scope.data, job => {
job = preProcess.convertTimeAtrtributes(job);
//store all attributes for each job
const attributes = {};
//storing employer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ angular
$scope.memberDetails = [];
//mapping memberID to name, position and display information
_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
Restangular.one("people/" + element.relationships.member.data.id)
.get()
.then(function(person) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

angular
.module('app.controllers')
.controller('OrganizationListCtrl', function($scope, $rootScope, $stateParams, $state, Restangular, apiDescriptor, dataTransformer) {
.controller('OrganizationListCtrl', function($scope, $rootScope, $stateParams, $state,
Restangular, apiDescriptor, dataTransformer, preProcess) {
var resourceName = $stateParams.resourceName;
var resourceId = $stateParams.id;
$scope.resourceName = resourceName;
Expand All @@ -26,6 +27,7 @@ angular

//mapping organizationID to every liaison in it
_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
//loop through every liaison in the organization
_.each(element.relationships.liaisons.data, function(liaison) {
Restangular.one("people/" + liaison.id)
Expand Down
4 changes: 2 additions & 2 deletions app/js/controllers/actions/person/person-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

angular
.module('app.controllers')
.controller('PersonListCtrl', function($scope, $rootScope, $stateParams, $state, Restangular, apiDescriptor, dataTransformer) {
.controller('PersonListCtrl', function($scope, $rootScope, $stateParams, $state, Restangular, apiDescriptor, dataTransformer, preProcess) {
var resourceName = $stateParams.resourceName;
var resourceId = $stateParams.id;
$scope.resourceName = resourceName;
Expand All @@ -29,7 +29,7 @@ angular

//mapping personID to name, position and display information
_.each($scope.data, function(person) {

person = preProcess.convertTimeAtrtributes(person);
var personData= {};
//getting roles
if (person.attributes.roles != null && person.attributes.roles.length > 0) {
Expand Down
1 change: 1 addition & 0 deletions app/js/controllers/actions/position/position-list-ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ angular
}

_.each($scope.data, function(element) {
element = preProcess.convertTimeAtrtributes(element);
element.attributes.responsibilities = element.attributes.responsibilities.length == 0 ? "None" : element.attributes.responsibilities.join(' ')
element.attributes.name = preProcess.positionToString(teamsIdToName, element, true);
element.attributes.team = preProcess.positionToString(teamsIdToName, element, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ angular
}

_.each($scope.data, element => {
element = preProcess.convertTimeAtrtributes(element);
Restangular.one("people/" + element.relationships.personToReimburse.data.id)
.get()
.then(data => {
Expand Down
Loading